|
OWLNext 7.0
Borland's Object Windows Library for the modern age
|
The TDiBitmap class is a combination of a TDib and a TBitmap. More...
#include <owl/dibitmap.h>
Public Member Functions | |
| TDiBitmap (HGLOBAL handle, TAutoDelete autoDelete=NoAutoDelete) | |
| Construct from existing bitmap handle. | |
| TDiBitmap (const TClipboard &clipboard) | |
| Construct from bitmap stored in clipboard. | |
| TDiBitmap (const TDib &src) | |
| Construct a copy from existing TDib. | |
| TDiBitmap (int width, int height, int nColors, uint16 mode=DIB_RGB_COLORS) | |
| Construct new bitmap with the passed-in parameters. | |
| TDiBitmap (HINSTANCE module, TResId resid) | |
| Construct a bitmap stored as resource. | |
| TDiBitmap (LPCTSTR filename) | |
| Construct from DIB stored as a file. | |
| TDiBitmap (const tstring &filename) | |
| String-aware overload. | |
| TDiBitmap (TFile &file, bool readFileHeader=true) | |
| Construct from a TFile. | |
| TDiBitmap (std::istream &is, bool readFileHeader=false) | |
| Construct from input stream. | |
| TDiBitmap (const TBitmap &bitmap, const TPalette *pal=0) | |
| Construct from a bitmap and palette information. | |
| ~TDiBitmap () | |
| Restore Bits data member to 0. | |
| int | Width () const |
| Return the width of the dib. | |
| int | Height () const |
| Return the height of the dib. | |
| TSize | Size () const |
| Return the size of the dib. | |
| int | BitsPixel () const |
| Return number of bits to hold each pixel. | |
Public Member Functions inherited from owl::TBitmap | |
| 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. | |
Public Member Functions inherited from owl::TDib | |
| TDib (HGLOBAL handle, TAutoDelete autoDelete=NoAutoDelete) | |
| Creates a TDib object and sets the Handle data member to the given borrowed handle. | |
| TDib (const TClipboard &clipboard) | |
| Constructs a TDib object with a handle borrowed from the given Clipboard. | |
| TDib (const TDib &src) | |
| This public copy constructor creates a complete copy of the given src object as in: | |
| TDib (int width, int height, uint32 nColors, uint16 mode=DIB_RGB_COLORS) | |
| Creates a DIB object with the given width, height, number of colors, mode values. | |
| TDib (HINSTANCE module, TResId resid) | |
| Creates a TDib given a module instance and a resource name or int Id. | |
| TDib (LPCTSTR filename) | |
| Creates a DIB object from the given resource file (.bmp). | |
| TDib (const tstring &filename) | |
| String-aware overload. | |
| TDib (TFile &file, bool readFileHeader=true) | |
| Creates a DIB from the file. | |
| TDib (std::istream &is, bool readFileHeader=false) | |
| Creates a DIB from the file stream. | |
| TDib (const TBitmap &bitmap, const TPalette *pal=nullptr) | |
| Creates a DIB object from the given resource bitmap and palette. | |
| virtual | ~TDib () |
| Destruct a TDib by unlocking & freeing its global memory handle as required. | |
| bool | operator== (const TDib &other) const |
| Compares two handles and returns true if this DIB's handle equals the other (other) DIB's handle. | |
| const BITMAPINFO * | GetInfo () const |
| Returns this DIB's Info field. | |
| BITMAPINFO * | GetInfo () |
| Returns this DIB's Info field. | |
| const BITMAPINFOHEADER * | GetInfoHeader () const |
| Returns this DIB's bmiHeader field of the BITMAPINFO structure contains information about the color and dimensions of this DIB. | |
| BITMAPINFOHEADER * | GetInfoHeader () |
| Returns this DIB's bmiHeader field of the BITMAPINFO structure contains information about the color and dimensions of this DIB. | |
| const TRgbQuad * | GetColors () const |
| Returns the bmiColors value of this DIB. | |
| TRgbQuad * | GetColors () |
| Returns the bmiColors value of this DIB. | |
| const uint16 * | GetIndices () const |
| Returns the bmiColors indexes of this DIB. | |
| uint16 * | GetIndices () |
| Returns the bmiColors indexes of this DIB. | |
| const void * | GetBits () const |
| Returns the Bits data member for this DIB. | |
| void * | GetBits () |
| Returns the Bits data member for this DIB. | |
| HANDLE | GetHandle () const |
| Returns the handle of the DIB with type HANDLE. | |
| operator HANDLE () const | |
| Return the handle of the DIB with type HANDLE. | |
| operator const BITMAPINFO * () const | |
| Typecasts this DIB by returning a pointer to its bitmap information structure (BITMAPINFO) which contains information about this DIB's color format and dimensions (size, width, height, resolution, and so on). | |
| operator BITMAPINFO * () | |
| Typecasts this DIB by returning a pointer to its bitmap information structure (BITMAPINFO) which contains information about this DIB's color format and dimensions (size, width, height, resolution, and so on). | |
| operator const BITMAPINFOHEADER * () const | |
| Typecasts this DIB by returning a pointer to its bitmap info header. | |
| operator BITMAPINFOHEADER * () | |
| Typecasts this DIB by returning a pointer to its bitmap info header. | |
| operator const TRgbQuad * () const | |
| Typecasts this DIB by returning a pointer to its colors structure. | |
| operator TRgbQuad * () | |
| Typecasts this DIB by returning a pointer to its colors structure. | |
| void | ToClipboard (TClipboard &clipboard) |
| Moves this dib to the clipboard. | |
| bool | IsOK () const |
| Returns false if Info is 0, otherwise returns true. | |
| bool | IsPM () const |
| Returns true if IsCore is true; that is, if the DIB is an old-style PM DIB using core headers. | |
| int | Width () const |
| Returns the width of the DIB. | |
| int | Height () const |
| Returns the height of the DIB. | |
| int | FlippedY (int y) const |
| Returns the coordinate of y if the direction of the y-axis was reversed. | |
| TSize | Size () const |
| Returns TSize(W,H), the size of this DIB. | |
| int | BitsPixel () const |
| Return the number of bits (2, 4, 8, 16, 24, or 32) used to store a pixel for the DIB. | |
| int | Pitch () const |
| Size of scan in bytes = Pixel Width * bits per pixel rounded up to a uint32 boundary. | |
| uint32 | Compression () const |
| Returns type of compression and encoding for bottom-up DIBs. | |
| uint32 | SizeImage () const |
| Returns number of bytes used to store the image. | |
| long | NumColors () const |
| Returns NumClrs, the number of colors in this DIB's palette. | |
| uint | StartScan () const |
| Returns the starting scan line. | |
| uint | NumScans () const |
| Returns the number of scans in this DIB. | |
| int32 | SizeColors () const |
| Return number of colors times the size of each entry in the table, whether it is an RGB color table or palette index table. | |
| uint32 | SizeDib () const |
| Size of dib is measured as the end of the bits minus the start of the block. | |
| uint16 | Usage () const |
| Returns the Mode for this DIB. | |
| int | XOffset (uint16 x) const |
| Returns the byte offset from the start of the scan line to the xth pixel. | |
| int | YOffset (uint16 y) const |
| Returns the starting position of the scan line. | |
| void * | PixelPtr (uint16 x, uint16 y) |
| Returns the byte of where the pixel is located. | |
| bool | WriteFile (const tstring &filename) |
| Writes the DIB into an external file. | |
| bool | Write (TFile &file, bool writeFileHeader=false) |
| Write this DIB to a file object. | |
| bool | Write (std::ostream &os, bool writeFileHeader=false) |
| Writes this DIB to an ostream. | |
| TColor | GetColor (int entry) const |
| Returns the color for the given palette entry. | |
| void | SetColor (int entry, const TColor &color) |
| Sets the given color for the given palette entry. | |
| int | FindColor (const TColor &color) |
| Returns the palette entry for the given color. | |
| int | MapColor (const TColor &fromColor, const TColor &toColor, bool doAll=false) |
| Maps the first or all occurances of fromColor to the toColor in the current palette of this DIB. | |
| uint16 | GetIndex (int entry) const |
| void | SetIndex (int entry, uint16 index) |
| Sets the given index for the given entry. | |
| int | FindIndex (uint16 index) |
| Returns the palette entry corresponding to the given index. | |
| int | MapIndex (uint16 fromIndex, uint16 toIndex, bool doAll=false) |
| Maps the fromIndex to the toIndex in the current palette of this DIB. | |
| bool | ChangeModeToPal (const TPalette &pal) |
| Converts the existing color table in place to use palette relative values. | |
| bool | ChangeModeToRGB (const TPalette &pal) |
| Converts the existing color table in place to use absolute RGB values. | |
| void | MapUIColors (uint mapColors, const TColor *bkColor=nullptr) |
| Maps the UI colors to the value specified in the parameter, mapColors, which is one of the values of the Map enum. | |
| void | MapToPalette (const TPalette &pal) |
| Modifies this DIB so that the pixels and color table coincide with a given palette. | |
Protected Member Functions | |
| void | InitBitmap () |
| Initializes our bitmap side from the DIB side. | |
| void | CheckValid (uint resId=IDS_GDIFAILURE) |
Protected Member Functions inherited from owl::TBitmap | |
| 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) |
Protected Member Functions inherited from owl::TDib | |
| TDib () | |
| Protected ctor- derived classes need to fill in handle & get info. | |
| void | InfoFromHeader (const BITMAPINFOHEADER &infoHeader) |
| Given a BITMAPINFOHEADER, allocate a global buffer for Handle & init Info. | |
| void | InfoFromHandle () |
| Locks the global/res handle if needed and extracts the pointers and cached info maintained as member variables from Info. | |
| void | CopyOnWrite () |
| Copies the DIB. | |
| void | ResToMemHandle () |
| Under Win32, resources are read-only. | |
| bool | ReadFile (const tstring &name) |
| Tests if the passed file is a Windows 3.x (or PM 1.x) DIB and if so read it. | |
| bool | Read (TFile &file, bool readFileHeader=false) |
| Read a Windows 3.x or PM 1.x device independent bitmap from a TFile Return true iff Dib was read OK. | |
| bool | Read (std::istream &is, bool readFileHeader=false) |
| Read a Windows 3.0 or PM 1.X device independent bitmap from an istream. | |
| bool | LoadResource (HINSTANCE, TResId) |
| Loads this DIB from the given resource and returns true if successful. | |
| virtual bool | Read (IFileIn &in, bool readFileHeader=false) |
| Reads a Windows 3.0 or PM 1.X device independent bitmap. | |
| virtual bool | Write (IFileOut &out, bool writeFileHeader=false) |
| Writes the DIB into a file stream. | |
| void | CheckValid (uint resId=IDS_GDIFAILURE) |
Additional Inherited Members | |
Public Types inherited from owl::TBitmap | |
| 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 Types inherited from owl::TDib | |
| enum | { MapFace = 0x01 , MapText = 0x02 , MapShadow = 0x04 , MapHighlight = 0x08 , MapFrame = 0x10 } |
| Map colors in color table matching stock UI colors to current UI colors. More... | |
| typedef HANDLE | THandle |
| TDib encapsulates an memory HANDLE w/ a DIB. | |
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) |
Static Protected Member Functions inherited from owl::TDib | |
| static int | ScanBytes (long w, int bpp) |
| Width+bpp to dword aligned bytes. | |
Protected Attributes inherited from owl::TGdiObject | |
| HANDLE | Handle |
| GDI handle of this object. | |
| bool | ShouldDelete |
| Should object delete GDI handle in dtor? | |
Protected Attributes inherited from owl::TDib | |
| HANDLE | Handle |
| GDI handle of this object. | |
| bool | ShouldDelete |
| Should object delete GDI handle in dtor? | |
The TDiBitmap class is a combination of a TDib and a TBitmap.
It can be constructed and manipulated like a TDib, but it can also be selected into a dc and manipulated with GDI. To guarantee functionality on all platforms, the TDibDC should be used as the memory dc to hold a TDiBitmap
Definition at line 33 of file dibitmap.h.
| owl::TDiBitmap::TDiBitmap | ( | HGLOBAL | handle, |
| TAutoDelete | autoDelete = NoAutoDelete ) |
Construct from existing bitmap handle.
Definition at line 59 of file dibitmap.cpp.
References InitBitmap().
| owl::TDiBitmap::TDiBitmap | ( | const TClipboard & | clipboard | ) |
Construct from bitmap stored in clipboard.
Definition at line 70 of file dibitmap.cpp.
References InitBitmap().
| owl::TDiBitmap::TDiBitmap | ( | const TDib & | src | ) |
Construct a copy from existing TDib.
Definition at line 81 of file dibitmap.cpp.
References InitBitmap().
| owl::TDiBitmap::TDiBitmap | ( | int | width, |
| int | height, | ||
| int | nColors, | ||
| uint16 | mode = DIB_RGB_COLORS ) |
Construct new bitmap with the passed-in parameters.
Definition at line 92 of file dibitmap.cpp.
References InitBitmap().
Construct a bitmap stored as resource.
Definition at line 103 of file dibitmap.cpp.
References InitBitmap().
| owl::TDiBitmap::TDiBitmap | ( | LPCTSTR | filename | ) |
Construct from DIB stored as a file.
Definition at line 114 of file dibitmap.cpp.
References InitBitmap().
| owl::TDiBitmap::TDiBitmap | ( | const tstring & | filename | ) |
Construct from a bitmap and palette information.
Definition at line 156 of file dibitmap.cpp.
References InitBitmap().
| owl::TDiBitmap::~TDiBitmap | ( | ) |
Restore Bits data member to 0.
Definition at line 167 of file dibitmap.cpp.
|
inline |
Return number of bits to hold each pixel.
Definition at line 131 of file dibitmap.h.
References owl::TDib::BitsPixel().
|
protected |
|
inline |
Return the height of the dib.
Definition at line 113 of file dibitmap.h.
References owl::TDib::Height().
|
protected |
Initializes our bitmap side from the DIB side.
TDib::Bits gets setup to point to the new DIBSection-managed DIB buffer.
Definition at line 27 of file dibitmap.cpp.
References owl::TGdiObject::Bitmap, owl::TDib::CheckValid(), owl::TDC::CreateDIBSection(), owl::TDib::GetInfo(), owl::TGdiBase::Handle, owl::TDib::NumColors(), owl::TDC::RealizePalette(), owl::TGdiObject::RefAdd(), owl::TDC::SelectObject(), owl::TDib::SizeImage(), and owl::TDib::Usage().
|
inline |
Return the size of the dib.
Definition at line 122 of file dibitmap.h.
References owl::TDib::Size().
|
inline |
Return the width of the dib.
Definition at line 104 of file dibitmap.h.
References owl::TDib::Width().