www.delorie.com/gnu/docs/xaos/xaos_25.html   search  
Buy GNU books!

An fast realtime interactive fractal zoomer

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3 Caluclation

Main caluclation is done using doit function. It is expected to call child's caluclation function when required and apply filter at output. It receives flags. Only flag in INTERRUPTIBLE for now. It is mainly for zooing engine so I do not describe it here. But filter is expected to pass this flag to child. Next parameter is time in milliseconds that expired since last doit call. It should be used to caluclate speed of animation.

Calculation loops returns flags. Flags is mask from following constants:

in case filter performs some animation and expect that calculation will be called again soon
in case something changed in output image (usual)
This is enabled by zooming engine in INTERRUPTIBLE mode in case that time exceeded.

An doit function changes image. Image structure contains following fields significant for you:

number of bytes per pixel (image depth)
palette of image.
array of pointers to beginings of every scanline of image
array of pointers like currlines but for previous image in case doublebuffering is enabled
set to 2 in case doublebuffering is active
pointer to function that flips oldlines and currlines.

palette structure contains following significant fields:

type of palette/image (C256, TRUECOLOR etc...)
number of allocated entries
array of allocated entries. Conversion table from number of iteration to pixel value.
Rgb values for pixels (NULL for TRUECOLOR, HICOLOR and similiar types)

To make easier writting calculation loops for different depths pixel8_t, pixel16_t and pixel32_t are predefined. You also can use include system as in edge detection filter, that lets you write calculation loops just once and use cpixel_t and it will be compiled for every bitmap depth. See edge detection filter (engine/edge.c and engine/edged.c) for implementation details.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003