Color
Cycle Colors  Lab Report
Cycle RGB Colors with 24-bit Pixels
The fractal image shown above was part of the 1991 ACM SigGraph Technical Slide Set, and appeared in the 1992 SigGraph Advance Program with a caption of "Insight Through Images."  Variations of this fractal biomorph also appeared in the Eurographics '91 Catalogue of Slide, Film, & Video Show.

This Julia Set biomorph was discovered while studying the "boundary" in the Evolution of the Mandelbrot Set sequence using programs written in Turbo Pascal.   See this and  similar biomorph  images in the Gallery on the Fractals and Chaos page.

Purpose
The purpose of this program is to display an 8-bit image as a 24-bit color image with the help of a user-defined color lookup table.

Materials and Equipment

Software Requirements
Windows 95/98, Delphi 3/4/5 (to recompile)
CycleColorsMap.EXE (CycleColors.EXE is not described here)
FractInt .MAP files

Hardware Requirements
Best when run on 800 x 600 pixel (or higher) monitor with 256-color display. You will see no difference in image quality if used on high color or true color displays.

Procedure (CycleColorsMap)

  1. Double click on the CycleColorsMap.EXE icon.
  2. Click the Read Maps button. Each of the 75 color maps will be displayed briefly.  
  3. Click on the Create Fractals button. The creation of the fractal may take as long as five minutes. An estimate of the time remaining will be displayed below the image while the fractal is being created. (This is linear extrapolation based on the number of ScanLines already processed and the number remaining.)
  4. Click on the Cycle Colors checkbox to start the background color cycling. Color cycling will continue until the program is exited. Notice that sometimes the color cycling will slow as Windows has other demands for processing time.

Discussion
Historically, color cycling was done with hardware assistance by shifting palette colors. With increasingly fast processors, color cycling is now possible in software even with 24-bit color. (Palettes don't exist with 15-bit or above color displays). The Windows AnimatePalette function cannot be used in high color or true color modes for color cycling.

CycleColorsMap.EXE takes 75 Fractint color maps (from Fractint and Jacco's web sites) with 18,554 RGB triples to display the same fractal biomorph. The program reads all the .MAP files in the directory with the .EXE and displays the 16-by-16 matrix of colors for each map before creating the fractal and cycling colors.

CycleColors.EXE takes five sets of 256 colors (256 shades of red, 256 shades of green, 256 shades of blue, 256 "fire storm" colors, and 256 shades of gray) and cycles through them as part of the IdleAction (when the Cycle Colors checkbox is checked). A new image is created from the base image and the array of TRGBTriples to update the display.

"Read Maps" uses FindFirst/FindNext/FindLast to locate and read all .MAP files in the directory of where the .EXE is located. Note that many of these color maps do not "honor" the Windows rule of reserving 20 fixed colors for palettes, but this is not an issue here since Windows palettes are not being used.

Note the form's IdleAction procedure for using idle time to cycle the colors.   This is setup in the class definition of a form:

type
  TFormColorCycle = class(TForm)
...
    public
      PROCEDURE IdleAction(Sender: TObject; VAR Done: BOOLEAN);
  end;

...

PROCEDURE TFormColorCycle.IdleAction(Sender: TObject; VAR Done: BOOLEAN);
BEGIN
...
END;

Also, see Borland's "Doing work while application is idle," FAQ1635D, for more information about idle processing.

In Delphi 5 drop a TApplicationEvents component on your form (from the Additional tab) and handle its OnIdle event.

Also, see Microsoft's Simulating Palette Animation on Non-Palette Displays:
http://support.microsoft.com/support/kb/articles/q130/4/76.asp

The complex math library in this project was written in Turbo Pascal and will be upgraded to use Delphi features at some point in the future.

Conclusions
Color cycling in high color or true color modes is possible using a user-defined lookup table of colors.


Keywords
ScanLine, IdleAction, TRGBTriple, TRGBTripleArray, Fractals, Fractint Color Maps, Fractal Biomorph, complex arithmetic

Files
Delphi 3/4/5 Source and EXE (307 KB): CycleColors.ZIP


Updated 26 Feb 2005


since 1 Nov 1998