ImageItterator Class Reference

#include <GLImageItterator.h>

List of all members.

Public Types

enum  Type { wrap, stretch }

Public Member Functions

 ImageItterator (Image &bitmap, int destX, int destY, Type type=stretch)
virtual ~ImageItterator ()
void reset ()
void incX ()
void incY ()
unsigned char * getPos ()

Protected Attributes

Imagebitmap_
float dx_
float dy_
int width_
Type type_
unsigned char * pos_
float posX_
float posY_


Detailed Description

A helper class that simplifes the iteration (looping) through the components contained within bitmap files.

ImageItterator bitmapItor(myBitmap, myRequiredWidth, myRequiredHeight, myRequiredType); for (int by=0; by<myRequiredHeight; by++, bitmapItor.incY()) { for (int bx=0; bx<myRequiredWidth; bx++, bitmapItor.incX()) { Get the bytes at bx, by position in the bitmap. This will be an array of 3 or 4 bytes depending on the bitmap type. unsigned char *sourceBits = bitmapItor.getPos(); } }

Definition at line 43 of file GLImageItterator.h.


Member Enumeration Documentation

enum ImageItterator::Type

Defines the type of the iteration. Wrap - The bitmap is tiled/repeated if it is smaller than the given destX/destY sizes. Stretch - The bitmap extents are stretched to match the destX and destY sizes.

Enumerator:
wrap 
stretch 

Definition at line 53 of file GLImageItterator.h.


Constructor & Destructor Documentation

ImageItterator::ImageItterator ( Image bitmap,
int  destX,
int  destY,
Type  type = stretch 
)

DestX is the maximum width you will ask the iterator to return. DestY is the maximum height you will ask the iterator to return. Type defines how these width/height maps the bitmaps size.

Definition at line 23 of file GLImageItterator.cpp.

References dx_, dy_, Image::getHeight(), Image::getWidth(), reset(), stretch, and width_.

ImageItterator::~ImageItterator (  )  [virtual]

Definition at line 45 of file GLImageItterator.cpp.


Member Function Documentation

void ImageItterator::reset (  ) 

Reset the iterator.

Definition at line 50 of file GLImageItterator.cpp.

References bitmap_, Image::getBits(), pos_, posX_, and posY_.

Referenced by ImageItterator().

void ImageItterator::incX (  ) 

Position the iterator at the next bitmap bytes in the row.

Definition at line 56 of file GLImageItterator.cpp.

References bitmap_, dx_, Image::getWidth(), and posX_.

void ImageItterator::incY (  ) 

Position the iterator at the next row.

Definition at line 62 of file GLImageItterator.cpp.

References bitmap_, dy_, Image::getBits(), Image::getHeight(), int(), pos_, posX_, posY_, and width_.

unsigned char * ImageItterator::getPos (  ) 

Get the bytes at the current iterator's position.

Definition at line 70 of file GLImageItterator.cpp.

References int(), pos_, and posX_.

Referenced by ImageModifier::addHeightToBitmap().


Member Data Documentation

Image& ImageItterator::bitmap_ [protected]

Definition at line 88 of file GLImageItterator.h.

Referenced by incX(), incY(), and reset().

float ImageItterator::dx_ [protected]

Definition at line 89 of file GLImageItterator.h.

Referenced by ImageItterator(), and incX().

float ImageItterator::dy_ [protected]

Definition at line 89 of file GLImageItterator.h.

Referenced by ImageItterator(), and incY().

int ImageItterator::width_ [protected]

Definition at line 90 of file GLImageItterator.h.

Referenced by ImageItterator(), and incY().

Type ImageItterator::type_ [protected]

Definition at line 91 of file GLImageItterator.h.

unsigned char* ImageItterator::pos_ [protected]

Definition at line 93 of file GLImageItterator.h.

Referenced by getPos(), incY(), and reset().

float ImageItterator::posX_ [protected]

Definition at line 94 of file GLImageItterator.h.

Referenced by getPos(), incX(), incY(), and reset().

float ImageItterator::posY_ [protected]

Definition at line 94 of file GLImageItterator.h.

Referenced by incY(), and reset().


The documentation for this class was generated from the following files:
Generated on Mon Feb 16 15:15:03 2009 for Scorched3D by  doxygen 1.5.3