Logo Search packages:      
Sourcecode: paintlib version File versions

PLBmp Class Reference

#include <plbitmap.h>

Inheritance diagram for PLBmp:

PLBmpInfo PLAnyBmp PLDirectFBBmp PLSDLBmp PLWinBmp PLDIBSection

List of all members.

Detailed Description

Device- and OS-independent bitmap class. Manipulates uncompressed bitmaps of all color depths.

This class is an abstract base class. It exists to define a format-independent interface for bitmap manipulation and to provide common routines. Derived classes must support at least the color depths 1, 8 and 32 bpp. PLBmp defines a public interface for general use and a protected interface for use by derived classes.

For 32 bpp, alpha channel information is stored in one byte (PL_RGBA_ALPHA) of each 4-byte pixel. To allow for optimizations when no alpha channel is present, a flag is set whenever the alpha information is valid. The complete alpha channel of a bitmap can be replaced by a different one by calling SetAlphaChannel(). A 0 in an alpha channel entry is completely transparent; a 255 is completely opaque.

Definition at line 40 of file plbitmap.h.

Public Member Functions

bool AlmostEqual (const PLBmpBase &Bmp, int epsilon) const
void ApplyFilter (const PLFilter &Filter)
 Applies a filter to the bitmap.
virtual void AssertValid () const
void AsString (char *psz, int len) const
virtual void Create (const PLBmpInfo &Info)
virtual void Create (PLLONG Width, PLLONG Height, PLWORD BitsPerPixel, bool bAlphaChannel, bool bIsGreyscale, PLBYTE *pBits=0, int Stride=0, const PLPoint &Resolution=PLPoint(0, 0))
void CreateCopy (const PLBmpBase &rSrcBmp, int BPPWanted=0)
void CreateFilteredCopy (PLBmpBase &rSrcBmp, const PLFilter &rFilter)
PLBYTE FindNearestColor (PLPixel32 cr)
int GetBitsPerPixel () const
virtual long GetBytesPerLine ()=0
int GetHeight () const
PLBYTE ** GetLineArray () const
PLPixel16 ** GetLineArray16 () const
PLPixel24 ** GetLineArray24 () const
PLPixel32 ** GetLineArray32 () const
virtual long GetMemUsed ()=0
 Returns memory used by a bitmap.
int GetNumColors ()
PLPixel32GetPalette () const
PLPixel32 GetPixel (int x, int y) const
 Slow but simple function to get a single pixel. 32 bpp only.
const PLPointGetResolution () const
const PLPointGetSize () const
int GetWidth () const
bool HasAlpha () const
bool IsGreyscale () const
bool IsLocked () const
 Returns whether a bitmap surface is locked. (See Lock for specifics.).
virtual void Lock (bool bReadable, bool bWriteable)
PLBmpoperator= (PLBmp const &Orig)
PLBmpoperator= (PLBmpBase const &Orig)
bool operator== (const PLBmpInfo &Other) const
bool const operator== (PLBmpBase const &Other)
 PLBmp ()
void SetAlphaChannel (PLBmpBase *pAlphaBmp)
void SetGrayPalette ()
void SetHasAlpha (bool b)
void SetPalette (PLPixel32 *pPal)
 Sets the color table to pPal. The contents of pPal are copied.
void SetPaletteEntry (PLBYTE Entry, PLPixel32 Value)
void SetPaletteEntry (PLBYTE Entry, PLBYTE r, PLBYTE g, PLBYTE b, PLBYTE a)
void SetPixel (int x, int y, PLPixel32 pixel)
 Slow but simple function to set a single pixel. 32 bpp only.
void SetQuantizationMode (int DitherType, int DitherPaletteType)
void SetResolution (const PLPoint &Resolution)
 Sets the bitmap resolution in pixels per inch.
virtual void Unlock ()
 Unlocks the Bitmap surface. (See Lock for specifics.).
virtual ~PLBmp ()
 Empty destructor.

Protected Member Functions

void create1BPPCopy (const PLBmpBase &rSrcBmp)
void create8BPPCopy (const PLBmpBase &rSrcBmp)
virtual void freeMembers ()=0
 Delete memory allocated by member variables.
virtual void initLineArray ()=0
 Initialize internal table of line addresses.
virtual void initLocals (PLLONG Width, PLLONG Height, PLWORD BitsPerPixel, bool bAlphaChannel, bool bIsGreyscale)
 Can be called from internalCreate() to initialize object state.
void internalCopy (const PLBmpBase &rSrcBmp)
virtual void internalCreate (PLLONG Width, PLLONG Height, PLWORD BitsPerPixel, bool bAlphaChannel, bool bIsGreyscale)=0
void SetBmpInfo (const PLBmpInfo &SrcInfo)
void SetBmpInfo (const PLPoint &Size, int bpp, const PLPoint &Resolution, bool bAlphaChannel, bool bIsGreyscale)

Protected Attributes

bool m_bAlphaChannel
bool m_bIsGreyscale
int m_bpp
int m_DitherPaletteType
int m_DitherType
int m_LockCount
PLBYTE ** m_pLineArray
PLPoint m_Resolution
PLPoint m_Size

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index