Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CP_Bitmap Class Reference

Manages a platform native bitmap/pixmap format.

List of all members.

Public Member Functions

Constructor / Destructor
virtual ~CP_Bitmap ()
 Destructor.
Getters
SInt16 GetColorDepth ()
CP_PaletteGetPalette ()
SInt32 GetRowBytes ()
char * GetPixelsPtr ()
CP_RGBColor GetPixelColor (SInt16 inCol, SInt16 inRow)
SInt16 Width ()
SInt16 Height ()
SInt16 GetNumberBitPlanes ()
SInt16 GetPixelSize ()
Lockers
void Lock ()
void Unlock ()
Setters
void SetPixel (SInt16 inCol, SInt16 inRow, SInt16 inPaletteIndex)
void SetPixel (SInt16 inCol, SInt16 inRow, SInt32 inColor)
void SetPixelColor (SInt16 inCol, SInt16 inRow, CP_RGBColor &inColor)
void SetPalette (CP_Palette *inPalette)
Constructor / Destructor
 CP_Bitmap (PixMapHandle inPixMap, bool inOwnsPixmap=false)
Getters
PixMapHandle GetPixMapHandle ()
Constructor / Destructor
 CP_Bitmap (HBITMAP inBitMap)
 CP_Bitmap (SInt16 inWidth, SInt16 inHeight, SInt16 inColorDepth, bool inIsGrayscale=false, OSGraphicsPort inDestPort=NULL, bool inTopDown=false)
 CP_Bitmap (SInt16 inWidth, SInt16 inHeight, SInt16 inColorDepth, CP_Palette *inPalette=NULL, OSGraphicsPort inDestPort=NULL, bool inTopDown=false)
Palette
void CreateBitmapPalette (SInt16 inColorDepth, bool inIsGrayscale=false)
void SetPaletteEntry (SInt16 inIndex, const CP_RGBColor &inColor)
Getters
HBITMAP GetBitmap ()

Protected Attributes

CP_PalettefBitmapPalette
bool fOwnsPixmap
PixMapHandle fPixMap
BITMAP fBitMapInfo
HBITMAP fBitMap
BITMAPINFOHEADER fBitmapInfoHeaderStruct
BITMAPINFOHEADER * fBitmapInfoHeader
HANDLE fDIB
SInt32fColorTable
char * fBitmapBits

Private Member Functions

Creator
void CreateEmptyBitmap (SInt16 inWidth, SInt16 inHeight, SInt16 inColorDepth, bool inIsGrayscale=false, OSGraphicsPort inDestPort=NULL, bool inTopDown=false)
void CreateEmptyBitmap (SInt16 inWidth, SInt16 inHeight, SInt16 inColorDepth, CP_Palette *inPalette=NULL, OSGraphicsPort inDestPort=NULL, bool inTopDown=false)
Getters
SInt32 GetBitmapBytesNeeded (SInt16 inWidth, SInt16 inHeight, SInt16 inColorDepth)
SInt32 GetBitsBytesNeeded (SInt16 inWidth, SInt16 inHeight, SInt16 inColorDepth)


Constructor & Destructor Documentation

CPLAT_Begin_Namespace_CPLAT CP_Bitmap::~CP_Bitmap  )  [virtual]
 

Destructor.

Exceptions:
none 

CP_Bitmap::CP_Bitmap PixMapHandle  inPixMap,
bool  inOwnsPixmap = false
 

Points to the bits of the Windows bitmap.

CP_Bitmap::CP_Bitmap HBITMAP  inBitMap  ) 
 

Windows - Constructor. This will construct the bitmap from the passed in Windows HBITMAP.

Parameters:
inBitMap The Windows HBITMAP to associate with this object.
Exceptions:
none 

CP_Bitmap::CP_Bitmap SInt16  inWidth,
SInt16  inHeight,
SInt16  inColorDepth,
bool  inIsGrayscale = false,
OSGraphicsPort  inDestPort = NULL,
bool  inTopDown = false
 

Windows - Constructor. This will construct the bitmap from the passed in parameters.

Parameters:
inWidth The width of the bitmap.
inHeight The height of the bitmap.
inColorDepth The color depth of the bitmap.
inIsGrayscale Flag to indicate if the bitmap is a color or grayscale one.
inDestPort The OS graphics port that this bitmap corresponds to.
inTopDown Flag to indicate if the image is drawn from top to bottom, as opposed to bottom to top.
Exceptions:
none 

CP_Bitmap::CP_Bitmap SInt16  inWidth,
SInt16  inHeight,
SInt16  inColorDepth,
CP_Palette inPalette = NULL,
OSGraphicsPort  inDestPort = NULL,
bool  inTopDown = false
 

Windows - Constructor. This will construct the bitmap from the passed in parameters.

Parameters:
inWidth The width of the bitmap.
inHeight The height of the bitmap.
inColorDepth The color depth of the bitmap.
inPalette The palette associated with this bitmap.
inDestPort The OS graphics port that this bitmap corresponds to.
inTopDown Flag to indicate if the image is drawn from top to bottom, as opposed to bottom to top.
Exceptions:
none 


Member Function Documentation

SInt16 CP_Bitmap::GetColorDepth  ) 
 

Returns the color depth of the bitmap.

Exceptions:
none 
Returns:
SInt16 The color depth of the bitmap.

CP_Palette * CP_Bitmap::GetPalette  ) 
 

Returns any palette associated with this bitmap.

Exceptions:
none 
Returns:
CP_Palette * The palette if any, associated with this bitmap.

SInt32 CP_Bitmap::GetRowBytes  ) 
 

Returns the number of row bytes of the bitmap.

Exceptions:
none 
Returns:
SInt32 The rowbytes of the bitmap.

char * CP_Bitmap::GetPixelsPtr  ) 
 

Returns a pointer to the first bit of the image data.

Exceptions:
none 
Returns:
char * The first bit of the image data.

CP_RGBColor CP_Bitmap::GetPixelColor SInt16  inCol,
SInt16  inRow
 

Returns the color of the pixel as the passed in row and column coordinates.

Parameters:
inCol The column we are after.
inRow The row we are after.
Exceptions:
none 
Returns:
CP_RGBColor The color fo the bit at the passed in coordinates.

SInt16 CP_Bitmap::Width  ) 
 

The width of the bitmap.

Exceptions:
none 
Returns:
SInt16 The width of the bitmap.

SInt16 CP_Bitmap::Height  ) 
 

The height of the bitmap.

Exceptions:
none 
Returns:
SInt16 The height of the bitmap.

SInt16 CP_Bitmap::GetNumberBitPlanes  ) 
 

Returns the number of bit planes that make up th bitmap.

Exceptions:
none 
Returns:
SInt16 The number of bit planes of the bitmap.

SInt16 CP_Bitmap::GetPixelSize  ) 
 

Returns the number of bits in a color component.

Exceptions:
none 
Returns:
SInt16 The numbe rof bits in a color component.

void CP_Bitmap::Lock  ) 
 

Locks the bitmap for direct pixel access. If the underlying OS doesn't require this, then nothing is done.

Exceptions:
none 
Returns:
void

void CP_Bitmap::Unlock  ) 
 

Unlocks the bitmap. If the underlying OS doesn't require this, then nothing is done. This call must be preceded by a Lock() call.

Exceptions:
none 
Returns:
void

void CP_Bitmap::SetPixel SInt16  inCol,
SInt16  inRow,
SInt16  inColor
 

Sets the color of the pixel at the passed in coordinates.

Parameters:
inCol The column to of the pixel to set.
inRow The row to of the pixel to set.
inColor An SInt16 representing the actual color value.
Exceptions:
none 
Returns:
void

void CP_Bitmap::SetPixel SInt16  inCol,
SInt16  inRow,
SInt32  inPaletteIndex
 

Sets the color of the pixel at the passed in coordinates.

Parameters:
inCol The column to of the pixel to set.
inRow The row to of the pixel to set.
inPaletteIndex The index of the color of the palette associated with this bitmap. This is used for a bit depth of 8 or less.
Exceptions:
none 
Returns:
void

void CP_Bitmap::SetPixelColor SInt16  inCol,
SInt16  inRow,
CP_RGBColor inColor
 

Sets the color of the pixel at the passed in coordinates using a CP_RGBColor.

Parameters:
inCol The column to of the pixel to set.
inRow The row to of the pixel to set.
inColor A CP_RGBColor for the pixel to be set.
Exceptions:
none 
Returns:
void

void CP_Bitmap::SetPalette CP_Palette inPalette  ) 
 

Sets the palette associated with this bitmap. Note: palettes are only used if the bit depth is 8 or less.

Parameters:
inPalette The palette to associate with this bitmap.
Exceptions:
none 
Returns:
void

PixMapHandle CP_Bitmap::GetPixMapHandle  ) 
 

Returns the MacOS pix map that is used to represent this object.

Exceptions:
none 
Returns:
PixMapHandle MacOS PixMapHandle for this bitmap.

void CP_Bitmap::CreateBitmapPalette SInt16  inColorDepth,
bool  inIsGrayscale = false
 

Create a color palette for use with our bitmap.

Parameters:
inColorDepth The color depth of the bitmap.
inIsGrayscale Flag to indicate if this is a grayscale image.
Exceptions:
none 
Returns:
SInt32 Bytes needed.

void CP_Bitmap::SetPaletteEntry SInt16  inIndex,
const CP_RGBColor inColor
 

Set a color entry info our palette.

Parameters:
inIndex Index of the color in the palette.
inColor Color to be placed in the palette.
Exceptions:
none 
Returns:
SInt32 Bytes needed.

HBITMAP CP_Bitmap::GetBitmap  ) 
 

Returns the Windows HBITMAP that is used to represent this object.

Exceptions:
none 
Returns:
HBITMAP The Window HBITMAP for this object.

void CP_Bitmap::CreateEmptyBitmap SInt16  inWidth,
SInt16  inHeight,
SInt16  inColorDepth,
bool  inIsGrayscale = false,
OSGraphicsPort  inDestPort = NULL,
bool  inTopDown = false
[private]
 

Creates an empty bitmap.

Parameters:
inWidth The width of the bitmap.
inHeight The height of the bitmap.
inColorDepth The color depth of the bitmap.
inDestPort The OS graphics port that this bitmap corresponds to.
inTopDown Flag to indicate if the image is drawn from top to bottom, as opposed to bottom to top.
Exceptions:
none 
Returns:
none

void CP_Bitmap::CreateEmptyBitmap SInt16  inWidth,
SInt16  inHeight,
SInt16  inColorDepth,
CP_Palette inPalette = NULL,
OSGraphicsPort  inDestPort = NULL,
bool  inTopDown = false
[private]
 

Creates an empty bitmap.

Parameters:
inWidth The width of the bitmap.
inHeight The height of the bitmap.
inColorDepth The color depth of the bitmap.
inPalette The palette associated with this bitmap.
inDestPort The OS graphics port that this bitmap corresponds to.
inTopDown Flag to indicate if the image is drawn from top to bottom, as opposed to bottom to top.
Exceptions:
none 
Returns:
none

SInt32 CP_Bitmap::GetBitmapBytesNeeded SInt16  inWidth,
SInt16  inHeight,
SInt16  inColorDepth
[private]
 

Return the number of bytes needed to store our bitmap information. This includes the header info, color table and bitmap bits.

Parameters:
inWidth Not used.
inHeight Not used.
inColorDepth The color depth of the bitmap.
Exceptions:
none 
Returns:
SInt32 Bytes needed.

SInt32 CP_Bitmap::GetBitsBytesNeeded SInt16  inWidth,
SInt16  inHeight,
SInt16  inColorDepth
[private]
 

Return the number of bytes needed to store the image portion of our bitmap.

Parameters:
inWidth Width of the image.
inHeight Height of the image.
inColorDepth The color depth of the bitmap.
Exceptions:
none 
Returns:
SInt32 Bytes needed.


Member Data Documentation

CP_Palette* CP_Bitmap::fBitmapPalette [protected]
 

bool CP_Bitmap::fOwnsPixmap [protected]
 

Palette used to represent the colors of this bitmap.

PixMapHandle CP_Bitmap::fPixMap [protected]
 

Flag to indicate if this object owns the underlying OS bitmap/pixmap.

BITMAP CP_Bitmap::fBitMapInfo [protected]
 

The MacOS pix map for this object.

HBITMAP CP_Bitmap::fBitMap [protected]
 

Windows information about this bitmap.

BITMAPINFOHEADER CP_Bitmap::fBitmapInfoHeaderStruct [protected]
 

Windows HBITMAP for this object.

BITMAPINFOHEADER* CP_Bitmap::fBitmapInfoHeader [protected]
 

Contains information about the Windows bitmap.

HANDLE CP_Bitmap::fDIB [protected]
 

Contains information about the Windows bitmap.

SInt32* CP_Bitmap::fColorTable [protected]
 

char* CP_Bitmap::fBitmapBits [protected]
 

Contains the color table for the Windows bitmap.


The documentation for this class was generated from the following files:
Generated on Sat Sep 17 20:01:23 2005 for CPLAT by  doxygen 1.4.0