OWLNext 7.0
Borland's Object Windows Library for the modern age
|
TBitmap is the GDI bitmap class derived from TGdiObject. More...
#include <owl/gdiobjec.h>
Public Types | |
typedef HBITMAP | THandle |
TBitmap encapsulates an HBITMAP. | |
Public Types inherited from owl::TGdiObject | |
enum | TType { None , Pen , Brush , Font , Palette , Bitmap , TextBrush } |
This enumeration is used to store the object type in the struct TObjInfo. More... | |
typedef HGDIOBJ | THandle |
TGdiObject encapsulates an HGDIOBJ. | |
Public Member Functions | |
TBitmap (HBITMAP handle, TAutoDelete autoDelete=NoAutoDelete) | |
Construct an alias TBitmap for an existing bitmap handle. | |
TBitmap (const TClipboard &clipboard) | |
Creates a TBitmap object with values from the given Clipboard. | |
TBitmap (const TBitmap &bitmap) | |
Creates a copy of the given bitmap object. | |
TBitmap (int width, int height, uint8 planes=1, uint8 bitCount=1, const void *bits=nullptr) | |
Creates a bitmap object from bitCount bits in the bits buffer with the given width, height, and planes argument values. | |
TBitmap (const BITMAP &bitmap) | |
Creates a bitmap object with the values found in the given bitmap structure. | |
TBitmap (const TDC &, int width, int height, bool discardable=false) | |
Creates a bitmap object for the given device context with the given argument values. | |
TBitmap (const TDC &, const TDib &dib, uint32 usage=CBM_INIT) | |
Creates a bitmap object for the given device context with the given dib and usage argument values. | |
TBitmap (const TMetaFilePict &metaFile, TPalette &palette, const TSize &size) | |
Creates a bitmap object from the given metaFile using the given palette and size arguments. | |
TBitmap (const TDib &dib, const TPalette *palette=nullptr) | |
Creates a bitmap object from the given dib and palette arguments. | |
TBitmap (HINSTANCE, TResId) | |
Creates a bitmap object for the given application instance from the given resource. | |
~TBitmap () | |
HBITMAP | GetHandle () const |
Returns the handle of the bitmap of type BITMAP. | |
operator HBITMAP () const | |
Typecasting operator. | |
bool | GetObject (BITMAP &bitmap) const |
Retrieves data (width, height, and color format) for this bitmap and sets it in the given BITMAP structure. | |
BITMAP | GetObject () const |
int | Width () const |
Returns the width of this bitmap using GDI's GetObject. | |
int | Height () const |
Returns the height of this bitmap using GDI's GetObject. | |
TSize | Size () const |
The width and height of the bitmap in pixels. | |
int | Planes () const |
Returns the number of planes in this bitmap. | |
int | BitsPixel () const |
Returns the number of bits per pixel in this bitmap. | |
uint32 | GetBitmapBits (uint32 count, void *bits) const |
Copies up to count bits of this bitmap to the buffer bits. | |
uint32 | SetBitmapBits (uint32 count, const void *bits) |
Copies up to count bits from the bits buffer to this bitmap. | |
bool | GetBitmapDimension (TSize &size) const |
Retrieves the size of this bitmap (width and height, measured in tenths of millimeters) and sets it in the size argument. | |
TSize | GetBitmapDimension () const |
Functional-style overload. | |
bool | SetBitmapDimension (const TSize &size, TSize *oldSize=nullptr) |
Sets the size of this bitmap from the given size argument (width and height, measured in tenths of millimeters). | |
void | ToClipboard (TClipboard &clipboard) |
Put a device-dependent bitmap on the clipboard as a (DD)BITMAP. | |
Public Member Functions inherited from owl::TGdiObject | |
~TGdiObject () | |
Decrement the reference count on this object. | |
HGDIOBJ | GetGdiHandle () const |
Returns the handle of the GDI object. | |
operator HGDIOBJ () const | |
Typecasting operator that converts this GDI object handle to type HGDIOBJ. | |
int | GetObject (int count, void *object) const |
Retrieve the object's attributes into a buffer. | |
bool | operator== (const TGdiObject &other) const |
Returns true if the handles are equal. This is a binary compare. | |
bool | operator< (const TGdiObject &other) const |
not implemented just to make happy STL | |
bool | IsGDIObject () const |
Returns true if this represents a real GDI object. | |
uint32 | GetObjectType () const |
Returns the type of the GDI object. | |
auto | IsHandleOwner () const -> bool |
Returns true if handle lifetime is managed. | |
Protected Member Functions | |
TBitmap () | |
void | Create (const TDib &dib, const TPalette &palette) |
Create a bitmap & get its handle, given a dib and a palette Used by ctors here and in derived classes. | |
void | Create (const TBitmap &src) |
Create a bitmap & get its handle, given an other bitmap Used by ctors here and in derived classes. | |
Protected Member Functions inherited from owl::TGdiObject | |
TGdiObject () | |
This default constructor sets Handle to 0 and ShouldDelete to true. | |
TGdiObject (HANDLE handle, TAutoDelete autoDelete=NoAutoDelete) | |
Create a wrapper for a given GDI object. | |
void | CheckValid (uint resId=IDS_GDIFAILURE) |
Additional Inherited Members | |
Static Public Member Functions inherited from owl::TGdiObject | |
static TObjInfo * | RefFind (HANDLE object) |
Searches for the given object handle. | |
static void | RefAdd (HANDLE handle, TType type) |
RefAdd adds a reference entry for the object with the given handle and type. | |
static void | RefRemove (HANDLE handle) |
Removes the reference entry to the object with the given handle. | |
static void | RefInc (HANDLE handle) |
Increments by 1 the reference count of the object associated with the given handle. | |
static void | RefDec (HANDLE handle, bool wantDelete) |
Decrements this object's reference count by 1 and deletes the object when the reference count reaches zero. | |
static int | RefCount (HANDLE handle) |
Returns this object's current reference count or -1 if the object is not found. | |
Static Protected Member Functions inherited from owl::TGdiObject | |
static void | _CheckValid (HANDLE handle, uint resId=IDS_GDIFAILURE) |
Protected Attributes inherited from owl::TGdiObject | |
HANDLE | Handle |
GDI handle of this object. | |
bool | ShouldDelete |
Should object delete GDI handle in dtor? | |
TBitmap is the GDI bitmap class derived from TGdiObject.
TBitMap can construct a bitmap from many sources. TBitmap objects are DDBs (device-dependent bitmaps), which are different from the DIBs (device-independent bitmaps) represented by TDib objects. This bitmap is the lowest level object that is actually selected into a DC.
Definition at line 510 of file gdiobjec.h.
TBitmap encapsulates an HBITMAP.
Definition at line 514 of file gdiobjec.h.
owl::TBitmap::TBitmap | ( | HBITMAP | handle, |
TAutoDelete | autoDelete = NoAutoDelete ) |
Construct an alias TBitmap for an existing bitmap handle.
Creates a TBitmap object and sets the Handle data member to the given borrowed handle. The ShouldDelete data member defaults to false, ensuring that the borrowed handle will not be deleted when the C++ object is destroyed.
Definition at line 33 of file bitmap.cpp.
References owl::TGdiObject::Bitmap, owl::TGdiObject::Handle, OWL_CDLEVEL, owl::TGdiObject::RefAdd(), owl::TGdiObject::ShouldDelete, and TRACEX.
owl::TBitmap::TBitmap | ( | const TClipboard & | clipboard | ) |
Creates a TBitmap object with values from the given Clipboard.
Definition at line 55 of file bitmap.cpp.
References owl::TGdiObject::Bitmap, owl::TGdiObject::Handle, OWL_CDLEVEL, owl::TGdiObject::RefAdd(), owl::TGdiObject::RefInc(), and TRACEX.
owl::TBitmap::TBitmap | ( | const TBitmap & | src | ) |
Creates a copy of the given bitmap object.
Duplicates a bitmap, bits and all
Definition at line 179 of file bitmap.cpp.
References Create(), owl::TGdiObject::Handle, OWL_CDLEVEL, and TRACEX.
owl::TBitmap::TBitmap | ( | int | width, |
int | height, | ||
uint8 | planes = 1, | ||
uint8 | bitCount = 1, | ||
const void * | bits = nullptr ) |
Creates a bitmap object from bitCount bits in the bits buffer with the given width, height, and planes argument values.
Definition at line 68 of file bitmap.cpp.
References owl::TGdiObject::Bitmap, owl::TGdiObject::CheckValid(), owl::TGdiObject::Handle, OWL_CDLEVEL, owl::TGdiObject::RefAdd(), TRACEX, and WARNX.
owl::TBitmap::TBitmap | ( | const BITMAP & | bitmap | ) |
Creates a bitmap object with the values found in the given bitmap structure.
Definition at line 82 of file bitmap.cpp.
References owl::TGdiObject::Bitmap, owl::TGdiObject::CheckValid(), owl::TGdiObject::Handle, OWL_CDLEVEL, owl::TGdiObject::RefAdd(), TRACEX, and WARNX.
Creates a bitmap object for the given device context with the given argument values.
Definition at line 116 of file bitmap.cpp.
References owl::TGdiObject::Bitmap, owl::TGdiObject::CheckValid(), owl::TDC::GetHDC(), owl::TGdiObject::Handle, OWL_CDLEVEL, owl::TGdiObject::RefAdd(), TRACEX, and WARNX.
Creates a bitmap object for the given device context with the given dib and usage argument values.
Definition at line 145 of file bitmap.cpp.
References owl::TGdiObject::Bitmap, owl::TGdiObject::CheckValid(), owl::TDC::GetHDC(), owl::TGdiObject::Handle, OWL_CDLEVEL, owl::TGdiObject::RefAdd(), TRACEX, and WARNX.
owl::TBitmap::TBitmap | ( | const TMetaFilePict & | metaFile, |
TPalette & | palette, | ||
const TSize & | size ) |
Creates a bitmap object from the given metaFile using the given palette and size arguments.
Definition at line 190 of file bitmap.cpp.
References owl::TGdiObject::Bitmap, owl::TGdiObject::CheckValid(), owl::TGdiObject::Handle, OWL_CDLEVEL, owl::TGdiObject::RefAdd(), and TRACEX.
Creates a bitmap object from the given dib and palette arguments.
A working palette constructed from the DIB's color table is used if no palette is supplied. The default system palette can also be passed using &TPalette::GetStock(TPalette::Default);
Definition at line 231 of file bitmap.cpp.
References owl::TGdiObject::Bitmap, owl::TGdiObject::CheckValid(), Create(), owl::TGdiObject::Handle, owl::NColors(), OWL_CDLEVEL, owl::TGdiObject::RefAdd(), and TRACEX.
Creates a bitmap object for the given application instance from the given resource.
Definition at line 165 of file bitmap.cpp.
References owl::TGdiObject::Bitmap, owl::TGdiObject::CheckValid(), owl::TGdiObject::Handle, OWL_CDLEVEL, owl::TGdiObject::RefAdd(), TRACEX, and WARNX.
owl::TBitmap::~TBitmap | ( | ) |
Definition at line 257 of file bitmap.cpp.
References OWL_CDLEVEL, and TRACEX.
|
protected |
Definition at line 45 of file bitmap.cpp.
References OWL_CDLEVEL, and TRACEX.
int owl::TBitmap::BitsPixel | ( | ) | const |
Returns the number of bits per pixel in this bitmap.
Definition at line 322 of file bitmap.cpp.
References GetObject().
Create a bitmap & get its handle, given an other bitmap Used by ctors here and in derived classes.
Assumes Handle can be written over, & adds handle to reference container.
Definition at line 385 of file bitmap.cpp.
References owl::TGdiObject::Bitmap, owl::TGdiObject::CheckValid(), owl::TGdiObject::Handle, and owl::TGdiObject::RefAdd().
Create a bitmap & get its handle, given a dib and a palette Used by ctors here and in derived classes.
Assumes Handle member can be over written, & adds handle to reference container.
Definition at line 360 of file bitmap.cpp.
References owl::TGdiObject::Bitmap, owl::TGdiObject::CheckValid(), owl::TGdiObject::Handle, owl::TDC::RealizePalette(), owl::TGdiObject::RefAdd(), and owl::TDC::SelectObject().
Copies up to count bits of this bitmap to the buffer bits.
Definition at line 1372 of file gdiobjec.h.
References GetHandle().
TSize owl::TBitmap::GetBitmapDimension | ( | ) | const |
Functional-style overload.
Definition at line 333 of file bitmap.cpp.
References _T, and GetBitmapDimension().
Retrieves the size of this bitmap (width and height, measured in tenths of millimeters) and sets it in the size argument.
Returns true if the call is successful; otherwise returns false.
Definition at line 1390 of file gdiobjec.h.
References GetHandle().
|
inline |
Returns the handle of the bitmap of type BITMAP.
Definition at line 1355 of file gdiobjec.h.
References owl::TGdiObject::GetGdiHandle().
BITMAP owl::TBitmap::GetObject | ( | ) | const |
Definition at line 266 of file bitmap.cpp.
References _T, and GetObject().
Retrieves data (width, height, and color format) for this bitmap and sets it in the given BITMAP structure.
To retrieve the bit pattern, use GetBitmapBits.
Definition at line 1409 of file gdiobjec.h.
References owl::TGdiObject::Bitmap, and owl::TGdiObject::GetObject().
int owl::TBitmap::Height | ( | ) | const |
Returns the height of this bitmap using GDI's GetObject.
Definition at line 289 of file bitmap.cpp.
References GetObject().
|
inline |
Typecasting operator.
Converts this bitmap's Handle to type HBITMAP (the data type representing the handle to a physical bitmap).
Definition at line 1364 of file gdiobjec.h.
int owl::TBitmap::Planes | ( | ) | const |
Returns the number of planes in this bitmap.
Definition at line 311 of file bitmap.cpp.
References GetObject().
Copies up to count bits from the bits buffer to this bitmap.
Definition at line 1380 of file gdiobjec.h.
References GetHandle().
Sets the size of this bitmap from the given size argument (width and height, measured in tenths of millimeters).
The previous size is set in the oldSize argument. Returns true if the call is successful; otherwise returns false.
Definition at line 1400 of file gdiobjec.h.
References GetHandle().
TSize owl::TBitmap::Size | ( | ) | const |
The width and height of the bitmap in pixels.
Definition at line 300 of file bitmap.cpp.
References GetObject().
void owl::TBitmap::ToClipboard | ( | TClipboard & | clipboard | ) |
Put a device-dependent bitmap on the clipboard as a (DD)BITMAP.
Clipboard assumes ownership of the actual bitmap handle & this TBitmap will not delete the handle
Definition at line 347 of file bitmap.cpp.
References owl::TGdiObject::Handle, owl::TGdiObject::RefRemove(), owl::TClipboard::SetClipboardData(), and owl::TGdiObject::ShouldDelete.
int owl::TBitmap::Width | ( | ) | const |
Returns the width of this bitmap using GDI's GetObject.
Definition at line 278 of file bitmap.cpp.
References GetObject().