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

FractalImage Class Reference

FractalImage stores all the parameters for a fractal image being generated, and the computed results. More...

#include <FractalImage.h>

List of all members.

Public Methods

 FractalImage (void)
 Constructor.

 FractalImage (const FractalImage &)
 Copy constructor.

 ~FractalImage (void)
 Destructor.

const Processorinq_processor (void) const
void set_processor (const Processor *)
 Sets the Processor to use.

const ComplexNumberinq_initial_z (void) const
void set_initial_z (const ComplexNumber &z)
void set_invert_u (bool invert_u)
bool inq_invert_u (void) const
void set_palette (const Palette *)
 Sets the Palette to use.

const Paletteinq_palette (void) const
void resize (int width, int height, rgbcolour_t *rgb_pixels)
 Resizes the image to the given width & height in pixels.

void set_view (const Vector2 &centre, double width, double angle)
 Sets the view transform.

const Matrix33inq_view_transform (void) const
const Vector2inq_view_centre (void) const
double inq_view_width (void) const
double inq_view_angle (void) const
int inq_width (void) const
int inq_height (void) const
int inq_npixels (void) const
unsigned short * inq_pixel_itns (void) const
const unsigned short * inq_pixel_itns (int x, int y) const
rgbcolour_tinq_rgb_pixels (void) const
void restart (void)
 This should be called whenever a new image is being calculated.

void update_all_rgb_pixels (void)
 Updates the colours of all RGB pixels.

ComplexNumber convert_point_to_z (const Vector2 &) const
 Converts the given point into a complex number.


Private Methods

void update_view_transform (void)
 Updates the view transform.


Private Attributes

const Processorm_processor
 Fractal image generator.

bool m_invert_u
 If set, u is set to the reciprical of the coordinate before calculating the fractal at that point.

ComplexNumber m_initial_z
 Starting value for 'z'.

const Palettem_palette
 Palette to use.

int m_width
 Width in pixels.

int m_height
 Height in pixels.

unsigned short * m_pixel_itns
 Pointer to array of 'width' x 'height' unsigned shorts.

rgbcolour_tm_rgb_pixels
 Pointer to RGB pixels.

Vector2 m_view_centre
 Centre of view in fractal space.

double m_view_width
 Width of view in fractal space.

double m_view_angle
 Angle in radians that view is rotated about view centre.

Matrix33 m_view_transform
 View transform.


Detailed Description

FractalImage stores all the parameters for a fractal image being generated, and the computed results.

This class stores both the number of iterations calculated for each pixel and the RGB colour for each pixel. This allows the RGB colours to be quickly recalculated if the palette is changec. This class also stores a pointer to the pixel processor 'm_processor' which performs the fractal calculations at each pixel. This is used by the FastImageGen and ProgressiveImageGen classes to generate this image.


Constructor & Destructor Documentation

FractalImage::FractalImage void   
 

Constructor.

FractalImage::FractalImage const FractalImage &    image
 

Copy constructor.

Copies the parameters from the given FractalImage. Note: any pixel values already processed in the given FractalImage are not copied. resize()/init() must be called before this FractalImage is used.

FractalImage::~FractalImage void   
 

Destructor.


Member Function Documentation

ComplexNumber FractalImage::convert_point_to_z const Vector2   v const
 

Converts the given point into a complex number.

Normally, this simply involves copying the x-coordinate to the real component, and the y-coordinate to the imaginary component, but other transforms such as taking the recipricol or square root may be applied to apply distortions to the image.

int FractalImage::inq_height void    const [inline]
 

const ComplexNumber& FractalImage::inq_initial_z void    const [inline]
 

bool FractalImage::inq_invert_u void    const [inline]
 

int FractalImage::inq_npixels void    const [inline]
 

const Palette* FractalImage::inq_palette void    const [inline]
 

const unsigned short* FractalImage::inq_pixel_itns int    x,
int    y
const [inline]
 

unsigned short* FractalImage::inq_pixel_itns void    const [inline]
 

const Processor* FractalImage::inq_processor void    const [inline]
 

rgbcolour_t* FractalImage::inq_rgb_pixels void    const [inline]
 

double FractalImage::inq_view_angle void    const [inline]
 

const Vector2& FractalImage::inq_view_centre void    const [inline]
 

const Matrix33& FractalImage::inq_view_transform void    const [inline]
 

double FractalImage::inq_view_width void    const [inline]
 

int FractalImage::inq_width void    const [inline]
 

void FractalImage::resize int    width,
int    height,
rgbcolour_t   rgb_pixels
 

Resizes the image to the given width & height in pixels.

set_view_transform() must be called after this method.

void FractalImage::restart void   
 

This should be called whenever a new image is being calculated.

It sets all the pixel values to the main colour.

void FractalImage::set_initial_z const ComplexNumber   z [inline]
 

void FractalImage::set_invert_u bool    invert_u [inline]
 

void FractalImage::set_palette const Palette   palette
 

Sets the Palette to use.

This must be set before any other methods are called.

void FractalImage::set_processor const Processor   processor
 

Sets the Processor to use.

This must be set before any other methods are called.

void FractalImage::set_view const Vector2   centre,
double    width,
double    angle
 

Sets the view transform.

Parameters:
centre  Point in fractal space on which view is centred.
width  Width of view in fractal space.
angle  Anti-clockwise angle of rotation of view (radians), about 'centre'.

void FractalImage::update_all_rgb_pixels void   
 

Updates the colours of all RGB pixels.

This is called whenever the palette is changed.

void FractalImage::update_view_transform void    [private]
 

Updates the view transform.

This should be called whenever the view or image size is changed.


Member Data Documentation

int FractalImage::m_height [private]
 

Height in pixels.

ComplexNumber FractalImage::m_initial_z [private]
 

Starting value for 'z'.

bool FractalImage::m_invert_u [private]
 

If set, u is set to the reciprical of the coordinate before calculating the fractal at that point.

const Palette* FractalImage::m_palette [private]
 

Palette to use.

unsigned short* FractalImage::m_pixel_itns [private]
 

Pointer to array of 'width' x 'height' unsigned shorts.

As the iterated value at each pixel exceeds the divergence threshold, the iteration count is set here for each pixel. Lines are order bottom to top, as is conventional for windows bitmaps. Note: this is the reverse to the convention for the coordinate space used by windows, which have (0,0) at top left.

const Processor* FractalImage::m_processor [private]
 

Fractal image generator.

rgbcolour_t* FractalImage::m_rgb_pixels [private]
 

Pointer to RGB pixels.

There are 'm_width' x 'm_height' pixels, ordered bottom to top row by row. These pixels are owned by the HBITMAP in CFracWnd, so it is that class's responsibility to make sure that if these pixels are invalidated (such as when the window is resized) this class is notified.

double FractalImage::m_view_angle [private]
 

Angle in radians that view is rotated about view centre.

Vector2 FractalImage::m_view_centre [private]
 

Centre of view in fractal space.

Matrix33 FractalImage::m_view_transform [private]
 

View transform.

Transforms a coordinate in image pixel space (y=0 at bottom) to the fractal space.

double FractalImage::m_view_width [private]
 

Width of view in fractal space.

int FractalImage::m_width [private]
 

Width in pixels.


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