Logo Search packages:      
Sourcecode: paintlib version File versions

PLWinBmp Class Reference

#include <plwinbmp.h>

Inheritance diagram for PLWinBmp:

PLBmp PLBmpInfo PLDIBSection

List of all members.


Detailed Description

This is the windows version of PLBmp. The internal storage format is a windows DIB. It supports all color depths allowed by windows: 1, 4, 8, 16, 24, and 32 bpp. The bits are always accessible: m_LockCount is always > 0 and IsLocked always returns true.

The subset of the windows DIB format supported is as follows: The DIB is stored so that header, palette, and bits are in one buffer. The bottom line is stored first (biHeight must be > 0) and the data is uncompressed (BI_RGB). Color tables for 16, 24, and 32 bpp are not supported. biClrUsed is always 0. The palette mode is DIB_RGB_COLORS. DIB_PAL_COLORS is not supported.

Note that almost all real-life DIBs conform to this subset anyway, so there shouldn't be any problems.

In the current version, some functions (notably CreateCopy) only support 1, 8 and 32 bpp. Sorry!

Definition at line 35 of file plwinbmp.h.


Public Member Functions

bool AlmostEqual (const PLBmpBase &Bmp, int epsilon) const
void AlphaBlt (PLWinBmp *pSrPLBmp, int x, int y)
void ApplyFilter (const PLFilter &Filter)
 Applies a filter to the bitmap.
virtual void AssertValid () const
void AsString (char *psz, int len) const
void CopyPalette (PLWinBmp *pSrPLBmp)
 Copies the palette over from pSrPLBmp.
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)
void CreateFromHBitmap (HBITMAP hBitMap)
 Takes a HBITMAP and converts it to a PLWinBmp.
void CreateFromHDIBBitmap (BITMAPINFOHEADER *pBIH, HPALETTE hPal=NULL)
virtual void CreateRes (HINSTANCE lh_ResInst, int ID)
virtual void Draw (HDC hDC, int x, int y, DWORD rop=SRCCOPY)
virtual BOOL DrawExtract (HDC hDC, POINT pntDest, RECT rcSrc)
 Draws a portion of the bitmap on the given device context.
PLBYTE FindNearestColor (PLPixel32 cr)
bool FromClipboard (UINT uFormat=CF_BITMAP)
BYTE * GetBits ()
int GetBitsPerPixel () const
BITMAPINFOHEADER * GetBMI ()
virtual long GetBytesPerLine ()
 Returns number of bytes used per line.
int GetHeight () const
PLBYTE ** GetLineArray () const
PLPixel16 ** GetLineArray16 () const
PLPixel24 ** GetLineArray24 () const
PLPixel32 ** GetLineArray32 () const
virtual long GetMemUsed ()
 Returns the amount of memory used by the object.
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
SIZE GetSize ()
 Returns the size of the bitmap in pixels.
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)
PLWinBmpoperator= (PLWinBmp const &Orig)
 Assignment operator.
PLWinBmpoperator= (PLBmpBase const &Orig)
 Assignment operator.
bool operator== (const PLBmpInfo &Other) const
bool const operator== (PLBmpBase const &Other)
 PLWinBmp (const PLBmpBase &Orig)
 Copy constructor.
 PLWinBmp (const PLWinBmp &Orig)
 Copy constructor.
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 StretchDraw (HDC hDC, int x, int y, int w, int h, DWORD rop=SRCCOPY)
virtual void StretchDraw (HDC hDC, int x, int y, double Factor, DWORD rop=SRCCOPY)
void ToClipboard ()
 Puts a copy of the bitmap in the clipboard.
void TracePalette ()
 Traces the values in the palette via PLTRACE();.
virtual void Unlock ()
 Unlocks the Bitmap surface. (See Lock for specifics.).
virtual ~PLWinBmp ()
 Destroys the bitmap.

Static Public Member Functions

static long GetBitsMemNeeded (LONG width, LONG height, WORD BitsPerPixel)
 Returns memory needed by bitmap bits.
static int GetLineMemNeeded (LONG width, WORD BitsPerPixel)
 Returns memory needed by one line.
static long GetMemNeeded (LONG width, LONG height, WORD BitsPerPixel)
 Returns memory needed by a bitmap with the specified attributes.

Protected Member Functions

void create1BPPCopy (const PLBmpBase &rSrcBmp)
void create8BPPCopy (const PLBmpBase &rSrcBmp)
virtual HANDLE createCopyHandle ()
virtual void freeMembers ()
 Deletes memory allocated by member variables.
virtual void initLineArray ()
 Initializes 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.
virtual void initPointers ()
void internalCopy (const PLBmpBase &rSrcBmp)
virtual void internalCreate (PLLONG Width, PLLONG Height, PLWORD BitsPerPixel, bool bAlphaChannel, bool bIsGreyscale)=0
virtual void internalCreate (BITMAPINFOHEADER *pBMI)
virtual void internalCreate (LONG Width, LONG Height, WORD BitsPerPixel, bool bAlphaChannel, bool bIsGreyscale)
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
BYTE * m_pBits
BITMAPINFOHEADER * m_pBMI
PLPixel32m_pClrTab
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