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

PLWinBmp Class Reference

#include <plwinbmp.h>

Inheritance diagram for PLWinBmp:

PLBmp PLBmpInfo PLDIBSection List of all members.

Public Member Functions

 PLWinBmp (const PLWinBmp &Orig)
 Copy constructor.

 PLWinBmp (const PLBmp &Orig)
 Copy constructor.

virtual ~PLWinBmp ()
 Destroys the bitmap.

PLWinBmpoperator= (PLBmp const &Orig)
 Assignment operator.

PLWinBmpoperator= (PLWinBmp const &Orig)
 Assignment operator.

void AlphaBlt (PLWinBmp *pSrPLBmp, int x, int y)
virtual long GetMemUsed ()
 Returns the amount of memory used by the object.

virtual long GetBytesPerLine ()
 Returns number of bytes used per line.

virtual void CreateRes (HINSTANCE lh_ResInst, int ID)
void CreateFromHBitmap (HBITMAP hBitMap)
 Takes a HBITMAP and converts it to a PLWinBmp.

void CreateFromHDIBBitmap (BITMAPINFOHEADER *pBIH, HPALETTE hPal=NULL)
SIZE GetSize ()
 Returns the size of the bitmap in pixels.

BITMAPINFOHEADER * GetBMI ()
virtual void Draw (HDC hDC, int x, int y, DWORD rop=SRCCOPY)
virtual void StretchDraw (HDC hDC, int x, int y, double Factor, DWORD rop=SRCCOPY)
virtual void StretchDraw (HDC hDC, int x, int y, int w, int h, DWORD rop=SRCCOPY)
virtual BOOL DrawExtract (HDC hDC, POINT pntDest, RECT rcSrc)
 Draws a portion of the bitmap on the given device context.

void ToClipboard ()
 Puts a copy of the bitmap in the clipboard.

bool FromClipboard (UINT uFormat=CF_BITMAP)
BYTE * GetBits ()
void CopyPalette (PLWinBmp *pSrPLBmp)
 Copies the palette over from pSrPLBmp.

void TracePalette ()
 Traces the values in the palette via PLTRACE();.


Static Public Member Functions

long GetMemNeeded (LONG width, LONG height, WORD BitsPerPixel)
 Returns memory needed by a bitmap with the specified attributes.

long GetBitsMemNeeded (LONG width, LONG height, WORD BitsPerPixel)
 Returns memory needed by bitmap bits.

int GetLineMemNeeded (LONG width, WORD BitsPerPixel)
 Returns memory needed by one line.


Protected Member Functions

virtual void internalCreate (LONG Width, LONG Height, WORD BitsPerPixel, bool bAlphaChannel, bool bIsGreyscale)
virtual void internalCreate (BITMAPINFOHEADER *pBMI)
virtual void freeMembers ()
 Deletes memory allocated by member variables.

virtual void initLineArray ()
 Initializes internal table of line addresses.

virtual HANDLE createCopyHandle ()
virtual void initPointers ()

Protected Attributes

BITMAPINFOHEADER * m_pBMI
BYTE * m_pBits

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.


Member Function Documentation

void PLWinBmp::CreateFromHDIBBitmap BITMAPINFOHEADER *  pBIH,
HPALETTE  hPal = NULL
 

Takes an existing device-independent bitmap and converts it to a PLWinBmp.

virtual void PLWinBmp::CreateRes HINSTANCE  lh_ResInst,
int  ID
[virtual]
 

Loads a bitmap from a windows resource (.rc or .res linked to the exe). Fails if the bitmap is compressed.

virtual void PLWinBmp::Draw HDC  hDC,
int  x,
int  y,
DWORD  rop = SRCCOPY
[virtual]
 

Draws the bitmap on the given device context using StretchDIBits.

Reimplemented in PLDIBSection.

bool PLWinBmp::FromClipboard UINT  uFormat = CF_BITMAP  ) 
 

Reads the clipboard into the bitmap. uFormat can be either CF_BITMAP or CF_DIB.

BYTE* PLWinBmp::GetBits  ) 
 

Gets a pointer to the bitmap bits. (Usually, using GetLineArray() is much easier!)

BITMAPINFOHEADER* PLWinBmp::GetBMI  ) 
 

Access the windows bitmap structure. Using this structure, all standard DIB manipulations can be performed.

virtual void PLWinBmp::internalCreate BITMAPINFOHEADER *  pBMI  )  [protected, virtual]
 

Creates a PLWinBmp from an existing bitmap pointer. Assumes that no memory is allocated before the call.

Reimplemented in PLDIBSection.

virtual void PLWinBmp::internalCreate LONG  Width,
LONG  Height,
WORD  BitsPerPixel,
bool  bAlphaChannel,
bool  bIsGreyscale
[protected, virtual]
 

Create a new empty DIB. Bits are uninitialized. Assumes that no memory is allocated before the call.

Reimplemented in PLDIBSection.

virtual void PLWinBmp::StretchDraw HDC  hDC,
int  x,
int  y,
int  w,
int  h,
DWORD  rop = SRCCOPY
[virtual]
 

Draws the bitmap on the given device context using StretchDIBits. Scales the bitmap so w is the width and h the height.

virtual void PLWinBmp::StretchDraw HDC  hDC,
int  x,
int  y,
double  Factor,
DWORD  rop = SRCCOPY
[virtual]
 

Draws the bitmap on the given device context using StretchDIBits. Scales the bitmap by Factor.


The documentation for this class was generated from the following file:
Generated on Sun Jun 6 13:42:23 2004 for paintlib by doxygen 1.3.2