Logo Search packages:      
Sourcecode: paintlib version File versions

PLDIBSection Class Reference

#include <pldibsect.h>

Inheritance diagram for PLDIBSection:

PLWinBmp PLBmp PLBmpInfo

List of all members.


Detailed Description

This is a windows DIBSection wrapped in a PLBmp-derived class. It can be used just like a PLWinBmp can be used. In addition, PLDIBSection can give access to the bitmap as a GDI bitmap handle. This bitmap handle can be selected into a device context. All normal GDI drawing functions can be used to write on the bitmap in this way.

Internally, PLDIBSections are stored with header and bits in two separate buffers.

Definition at line 27 of file pldibsect.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 Detach ()
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.
HBITMAP GetHandle ()
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)
PLDIBSectionoperator= (PLDIBSection const &Orig)
 Assignment operator.
PLDIBSectionoperator= (PLBmpBase const &Orig)
 Assignment operator.
bool operator== (const PLBmpInfo &Other) const
bool const operator== (PLBmpBase const &Other)
 PLDIBSection (const PLDIBSection &Orig)
 Copy constructor.
 PLDIBSection (const PLBmpBase &Orig)
 Copy constructor.
 PLDIBSection ()
 Creates an empty bitmap.
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 ~PLDIBSection ()
 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 ()
 Set color table pointer & pointer to bits based on m_pBMI.
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

Private Attributes

bool m_bOwnsBitmap
HBITMAP m_hBitmap

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

Generated by  Doxygen 1.6.0   Back to index