Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members

PLBmp Class Reference

#include <plbitmap.h>

Inheritance diagram for PLBmp:

PLBmpBase PLBmpInfo PLAnyBmp PLDirectFBBmp PLWinBmp PLDIBSection List of all members.

Public Member Functions

 PLBmp ()
virtual ~PLBmp ()
 Empty destructor.

PLBmpoperator= (PLBmpBase const &Orig)
PLBmpoperator= (PLBmp const &Orig)
virtual void Create (PLLONG Width, PLLONG Height, const PLPixelFormat &pf, PLBYTE *pBits=0, int Stride=0, const PLPoint &Resolution=PLPoint(0, 0))
virtual void Create (const PLBmpInfo &Info)
void CreateCopy (const PLBmpBase &rSrcBmp, const PLPixelFormat &pfWanted=PLPixelFormat::DONTCARE)
void CreateFilteredCopy (PLBmpBase &rSrcBmp, const PLFilter &rFilter)
virtual long GetMemUsed ()=0
 Returns memory used by a bitmap.

virtual long GetBytesPerLine ()=0
void ApplyFilter (const PLFilter &Filter)
 Applies a filter to the bitmap.


Protected Member Functions

virtual void initLocals (PLLONG Width, PLLONG Height, const PLPixelFormat &pf)
 Can be called from internalCreate() to initialize object state.

virtual void internalCreate (PLLONG Width, PLLONG Height, const PLPixelFormat &pf)=0
virtual void initLineArray ()=0
 Initialize internal table of line addresses.

virtual void freeMembers ()=0
 Delete memory allocated by member variables.

void internalCopy (const PLBmpBase &rSrcBmp)

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.


Constructor & Destructor Documentation

PLBmp::PLBmp  ) 
 

Empty constructor. Constructors in derived classes create a small empty bitmap to ensure that the object is always in a sane state.


Member Function Documentation

virtual void PLBmp::Create const PLBmpInfo Info  )  [virtual]
 

Creates a new empty bitmap. Info contains the metadata (width, height, etc.) to be used in creation.

virtual void PLBmp::Create PLLONG  Width,
PLLONG  Height,
const PLPixelFormat &  pf,
PLBYTE *  pBits = 0,
int  Stride = 0,
const PLPoint Resolution = PLPoint(0, 0)
[virtual]
 

Creates a new empty bitmap. Memory for the bits is allocated but not initialized. Previous contents of the bitmap object are discarded. If bAlphaChannel is true, the bitmap is assumed to contain a valid alpha channel. If pBits is non-null, it contains pixel data in the format expected by the bitmap and Stride is the distance in bytes from one source line to the next. In this case, the data in pBits is copied into the internal buffer of the PLBmp.

void PLBmp::CreateCopy const PLBmpBase rSrcBmp,
const PLPixelFormat &  pfWanted = PLPixelFormat::DONTCARE
 

Creates a copy of rSrcBmp, converting color depth if nessesary. Supports 1, 8, 16, 24 and 32 BPP. Alpha channel information is preserved if supported by the target bit depth. Conversion to 8 bpp is possible only from 1 and 32 bpp.

void PLBmp::CreateFilteredCopy PLBmpBase rSrcBmp,
const PLFilter rFilter
 

Creates a copy of rSrcBmp, applying rFilter on the way. Depending on the filter called, this is often much faster than CreateCopy() followed by ApplyFilter().

virtual long PLBmp::GetBytesPerLine  )  [pure virtual]
 

Returns number of bytes used per line. Note that this is not the stride of the bitmap.

Implemented in PLAnyBmp, PLDirectFBBmp, and PLWinBmp.

void PLBmp::internalCopy const PLBmpBase rSrcBmp  )  [protected]
 

Creates a new PLBmp as copy of rSrcBmp. Assumes there is no memory allocated yet.

virtual void PLBmp::internalCreate PLLONG  Width,
PLLONG  Height,
const PLPixelFormat &  pf
[protected, pure virtual]
 

Create a new bitmap with uninitialized bits. (Assume no memory is allocated yet.)

Implemented in PLAnyBmp.

PLBmp & PLBmp::operator= PLBmpBase const &  Orig  )  [inline]
 

Assignment operator. Note that assignment between different derived classes is possible and results in a format conversion.

Reimplemented in PLAnyBmp, PLDIBSection, and PLWinBmp.

Definition at line 155 of file plbitmap.h.

Referenced by PLWinBmp::operator=(), PLDirectFBBmp::operator=(), PLDIBSection::operator=(), and PLAnyBmp::operator=().


The documentation for this class was generated from the following file:
Generated on Mon Sep 13 16:16:41 2004 for paintlib by doxygen 1.3.2