Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

ProgressiveImageGen Class Reference

This class processes a FractalImage by iterating the pixel values progressively. More...

#include <ProgressiveImageGen.h>

Inheritance diagram for ProgressiveImageGen:

ImageGen List of all members.

Public Methods

 ProgressiveImageGen (FractalImage *)
 Constructor.

 ~ProgressiveImageGen (void)
 Destructor.

void init (void)
 Overriden from ImageGen base class.

void restart (void)
 Overriden from ImageGen base class.

bool process (void)
 Overriden from ImageGen base class.

bool inq_done (void) const
 Overriden from ImageGen base class.

int inq_progress (void) const
 Overriden from ImageGen base class.


Private Methods

void init_pixels (void)
 Initialises the FractalPixels for generating a new image.

void process_line (void)
 Performs one iteration on all the pixels on the given line.


Private Attributes

FractalImagem_image
 FractalImage.

ComplexNumberm_pixel_values
 Current value of 'z' at each pixel.

bool * m_pixels_done
 Flag for each pixel, set true once the value of 'z' at that pixel has exceeded the divergence threshold.

bool * m_lines_done
 Flags for each line, set once all pixels on that line have been computed.

Vector2 m_origin
 Position in fractal space of first pixel on the first (bottom) row.

Vector2 m_rowstart
 Position in fractal space of first pixel on the current row.

Vector2 m_xoffs
 Offset in fractal space from a pixel to the next.

Vector2 m_yoffs
 Offset in fractal space from a pixel in one row to the next.

unsigned short m_current_itn
 Current iteration - each pixel in the whole image is advanced one iteration at a time.

bool m_done
 Flag set when no more processing to be done.

int m_nextline
 Next line to process in OnIdle.

bool m_curr_itn_all_done
 This flag is set at the beginning of each iteration, and cleared if any pixels are found that are not complete.

bool m_curr_itn_any_changed
 This flag is cleared at the beginning of each iteration, and set if any pixels are completed on this iteration, which indicates that the display needs to be updated.


Detailed Description

This class processes a FractalImage by iterating the pixel values progressively.

This allows the display to be updated regularly, rather than having to wait before anything is seen. This class maintains the state that allows the processing to be done in many incremental steps, which are called from OnIdle(). Multiple passes are run over all pixels so that the whole image is updated regularly, rather than calculating each pixel one by one. On each iteration, all pixels that have exceed the divergence threshold are set using the current iteration value. Although this approach is slower, it gives a more interesting image more quickly that develops over time.


Constructor & Destructor Documentation

ProgressiveImageGen::ProgressiveImageGen FractalImage   image
 

Constructor.

Parameters:
image  The image that this ProgressiveImageGen will generate.

ProgressiveImageGen::~ProgressiveImageGen void   
 

Destructor.


Member Function Documentation

void ProgressiveImageGen::init void    [virtual]
 

Overriden from ImageGen base class.

Initialises thie ProgressiveImageGen for processing the current FractalImage. This must be called before any processing is done. This must also be called if the size of the image ever changes.

Implements ImageGen.

void ProgressiveImageGen::init_pixels void    [private]
 

Initialises the FractalPixels for generating a new image.

bool ProgressiveImageGen::inq_done void    const [virtual]
 

Overriden from ImageGen base class.

Returns:
Returns true when image has been generated.

Implements ImageGen.

int ProgressiveImageGen::inq_progress void    const [virtual]
 

Overriden from ImageGen base class.

Returns:
Returns the value shown as a progress indicator in the status bar.

Implements ImageGen.

bool ProgressiveImageGen::process void    [virtual]
 

Overriden from ImageGen base class.

Processes the current line.

Returns:
Returns true if the display should be updated, otherwise false.

Implements ImageGen.

void ProgressiveImageGen::process_line void    [private]
 

Performs one iteration on all the pixels on the given line.

Returns:
Returns a status value which has PROC_ALL_DONE set if all pixels on this line are fully computed, and PROC_CHANGED if any pixels have just been fully computed which means the display needs to be updated.

void ProgressiveImageGen::restart void    [virtual]
 

Overriden from ImageGen base class.

Restarts the processing. This should be called whenever any attribute that affects the image is changed, such as the view transform or the palette.

Implements ImageGen.


Member Data Documentation

bool ProgressiveImageGen::m_curr_itn_all_done [private]
 

This flag is set at the beginning of each iteration, and cleared if any pixels are found that are not complete.

bool ProgressiveImageGen::m_curr_itn_any_changed [private]
 

This flag is cleared at the beginning of each iteration, and set if any pixels are completed on this iteration, which indicates that the display needs to be updated.

unsigned short ProgressiveImageGen::m_current_itn [private]
 

Current iteration - each pixel in the whole image is advanced one iteration at a time.

bool ProgressiveImageGen::m_done [private]
 

Flag set when no more processing to be done.

FractalImage* ProgressiveImageGen::m_image [private]
 

FractalImage.

bool* ProgressiveImageGen::m_lines_done [private]
 

Flags for each line, set once all pixels on that line have been computed.

This array has 'image-height' elements.

int ProgressiveImageGen::m_nextline [private]
 

Next line to process in OnIdle.

Vector2 ProgressiveImageGen::m_origin [private]
 

Position in fractal space of first pixel on the first (bottom) row.

ComplexNumber* ProgressiveImageGen::m_pixel_values [private]
 

Current value of 'z' at each pixel.

This array has one element per pixel, stored in the same order as the pixels in the FractalImage.

bool* ProgressiveImageGen::m_pixels_done [private]
 

Flag for each pixel, set true once the value of 'z' at that pixel has exceeded the divergence threshold.

This array has one element per pixel, stored in the same order as the pixels in the FractalImage.

Vector2 ProgressiveImageGen::m_rowstart [private]
 

Position in fractal space of first pixel on the current row.

Vector2 ProgressiveImageGen::m_xoffs [private]
 

Offset in fractal space from a pixel to the next.

This is determined from the view transform and the image size.

Vector2 ProgressiveImageGen::m_yoffs [private]
 

Offset in fractal space from a pixel in one row to the next.

This is determined from the view transform and the image size.


The documentation for this class was generated from the following files:
Generated on Sun Jul 21 11:52:18 2002 for FractalViewer by doxygen1.2.16