oofDIB Class Reference
#include <oofDIB.h>
Inheritance diagram for oofDIB:
[legend]Collaboration diagram for oofDIB:
[legend]List of all members.
Detailed Description
The oofDIB class defined here formalises some of the processing in the original SHOWDIB sample which created a HANDLE containing a BITMAPINFO, palette data and the bits.
That single handle format is the CF_DIB format in which device-independent bitmaps are stored in the Windows clipboard (CF_BITMAP stores an HBITMAP).
Includes accessor functions with common casts so user code doesn't have to know what are safe casts.
Because it inherits from OOF_mixRefCount you can copy concrete oofDIB objects around with impunity as they just update reference counts to a shared bitmap. This is a weakness if you reset the bitmap.
- Todo:
- generalise to handle bitmaps other than 24 or 32 bit (ie: cope with the palette info)
put the individual members back into a single CF_DIB format internally.
add COW functionality so can update an oofDIB without affecting others sharing storage.
|
Public Member Functions |
| | oofDIB () |
| | ~oofDIB () |
| void | draw (int x, int y, int inWidth, int inHeight, bool onPrinter, HDC drawDC) |
| | Create a compatible bitmap and use to blit from our bitmap to the drawDC.
|
| void | copyFromHBITMAP (HBITMAP copiedBitmap, HDC usingHDC=0) |
| | Sample values in the BITMAP we get bmType = 0 bmWidth = 119 bmHeight = 111 bmWidthBytes = 476 bmPlanes = 1 bmBitsPixel = 32 bmBits = 0.
|
| BITMAPINFO * | getBitmapInfo () const |
| LPBITMAPINFOHEADER | getBitmapInfoHeader () const |
| BYTE * | getBits () |
| unsigned long | height () const |
| unsigned long | width () const |
| void | incRefs () |
| void | decRefs () |
Protected Attributes |
| unsigned int | mReferences |
Constructor & Destructor Documentation
Member Function Documentation
| void oofDIB::copyFromHBITMAP |
( |
HBITMAP |
copiedBitmap, |
|
|
HDC |
usingHDC = 0 |
|
) |
|
|
|
|
Sample values in the BITMAP we get bmType = 0 bmWidth = 119 bmHeight = 111 bmWidthBytes = 476 bmPlanes = 1 bmBitsPixel = 32 bmBits = 0.
- Note:
- p337 of Win32 programming says LoadBitmap (as used by CBitmap) won't load bitmaps using 256 color palettes but the above sample shows a bitmap loaded in that manner - I think it will load 32bit bitmaps nicely under more recent Win32.
- Why bmBits is zero
- Andy theory - 12th Mar 2002. Reading carefully between the lines of various Windows notes I wonder if it is only possible to get the bits back from a bitmap when it is selected into a DC?
- Parameters:
-
| copiedBitmap | may be a bitmap or DIBSection |
|
| void OOF_mixRefCount::decRefs |
( |
|
) |
[inherited] |
|
| void oofDIB::draw |
( |
int |
x, |
|
|
int |
y, |
|
|
int |
inWidth, |
|
|
int |
inHeight, |
|
|
bool |
onPrinter, |
|
|
HDC |
drawDC |
|
) |
|
|
|
|
Create a compatible bitmap and use to blit from our bitmap to the drawDC.
- Note:
- in case anyone gets a bright idea about keeping the DC from the copyFromHBITMAP call remember that may be a different DC to that on which we are drawing!
Similar logic to that in DrawBitmapScaled in oofPict.cpp |
| BITMAPINFO* oofDIB::getBitmapInfo |
( |
|
) |
const [inline] |
|
| LPBITMAPINFOHEADER oofDIB::getBitmapInfoHeader |
( |
|
) |
const [inline] |
|
| BYTE* oofDIB::getBits |
( |
|
) |
[inline] |
|
| unsigned long oofDIB::height |
( |
|
) |
const |
|
| void OOF_mixRefCount::incRefs |
( |
|
) |
[inline, inherited] |
|
| unsigned long oofDIB::width |
( |
|
) |
const |
|
Member Data Documentation
The documentation for this class was generated from the following files:
Generated on Thu Jan 1 21:33:25 2004 for OOFILE by
1.3.5