TBitmap also encapsulates a number of standard API calls for manipulating palettes.
- You can get the same information as you get from GetObject, except one item at a time, using the following functions. Each function returns a characteristic of the bitmap object:
uint8 Planes();
int Width();
uint8 BitsPixel();
int Height();
- The TBitmap::GetBitmapDimension andTBitmap::SetBitmapDimension functions let you find out and change the dimensions of the bitmap. GetBitmapDimension, which takes a reference to a TSize object as its only parameter, places the size of the bitmap into the TSize object. SetBitmapDimension can take two parameters, the first a reference to a TSize object containing the new size for the bitmap, and the second a pointer to a TSize, in which the function places the old size of the bitmap. You do not have to pass the second parameter to SetBitmapDimension. Both functions return true if the operation was successful.
GetBitmapDimension and SetBitmapDimension do not actually affect the size of the bitmap in pixels. Instead they modify only the physical size of the bitmap, which is often used by programs when printing or displaying bitmaps. Using these functions lets you adjust the size of the bitmap depending on the size of the physical screen.
- The TBitmap::GetBitmapBits and TBitmap::SetBitmapBits functions let you query and change the bits in a bitmap. Both functions take two parameters: a uint32 and a void *. The uint32 specifies the size of the array in bytes, and the void * points to an array. GetBitmapBits fills the array with bits from the bitmap, up to the number of bytes specified by the uint32 parameter. SetBitmapBits copies the array into the bitmap, copying over the number of bytes specified in the uint32 parameter.
- You can move a bitmap to the Clipboard using the TBitmap::ToClipboard function. ToClipboard takes a reference to a TClipboard object as a parameter. Because ToClipboard actually removes the object from your application, you should usually use a TBitmap constructor to create a temporary object, as follows:
See Also