[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Graphics' (#lcl)

# TCustomBitmap

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

TCustomBitmap - the base class for TBitmap.

## Declaration

Source position: graphics.pp line 1381

`type TCustomBitmap = class(TRasterImage)`
`protected`
`procedure MaskHandleNeeded; override;` |  | Ensures that a handle is allocated for the image mask (when needed).
`procedure PaletteNeeded; override;` |  | Ensures that a handle is allocated for the Palette in the image.
`function CanShareImage(); override;` |  | Indicates if the image uses the specified shared image class.
`procedure Changed(); override;` |  | Performs actions needed when the image data for the bitmap has been changed.
`function CreateDefaultBitmapHandle(); override;` |  | Creates a handle for the bitmap using the bitmap handle type in the bitmap image data.
`procedure FreeMaskHandle;` |  | FreeMaskHandle - method to release Mask handle.
`function GetBitmapHandle; override;` |  | Gets the value for the Handle property.
`function GetMaskHandle; override;` |  | Gets the value for the MaskHandle property.
`function GetPalette; override;` |  | Gets the value for the Palette property.
`function GetPixelFormat; override;` |  | Gets the value for the PixelFormat property.
`function GetRawImagePtr; override;` |  | Gets a pointer with the raw image data.
`function GetRawImageDescriptionPtr; override;` |  | Gets a pointer to the image descriptor for the shared Bitmap image.
`class function GetSharedImageClass; override;` |  | Gets the class reference used to create new shared image instances in the class.
`procedure HandleNeeded; override;` |  | Ensures that the handle for the bitmap has been assigned.
`function InternalReleaseBitmapHandle; override;` |  |
`function InternalReleaseMaskHandle; override;` |  |
`function InternalReleasePalette; override;` |  | InternalReleasePalette - releases Palette Handle and returns its value.
`procedure RawimageNeeded();` |  | Ensures that the RawImage data is allocated prior to use.
`procedure SetHandle(); override;` |  | Re-implements the method from the ancestor class.
`procedure SetPixelFormat(); override;` |  | Sets the value for the PixelFormat property.
`procedure UnshareImage(); override;` |  | Frees the shared image in the bitmap, and creates a new one.
`function UpdateHandles(); override;` |  | Sets the handles for the image and mask in the shared Bitmap to the specified values.
`public`
`constructor Create; override;` |  | Constructor for the class instance.
`destructor Destroy; override;` |  | Destructor for the class instance.
`procedure Assign(); override;` |  | Copies values from the specified persistent object into the class instance.
`procedure Clear; override;` |  | Clears the content for the bitmap image.
`procedure FreeImage; override;` |  | Releases the resources for the image when it is discarded.
`function LazarusResourceTypeValid(); override;` |  | Determines if the specified resource type is valid for the image format.
`function BitmapHandleAllocated; override;` |  | Returns True if a handle has been allocated for the Bitmap.
`function MaskHandleAllocated; override;` |  | Determines if the mask handle has been allocated for the image.
`function PaletteAllocated; override;` |  | Indicates whether a handle has been allocated for a palette in the image.
`function ReleaseHandle;` |  | Releases the bitmap handle for the shared image.
`procedure SetHandles(); override;` |  | Sets handles for the bitmap and the mask to the specified values.
`procedure SetSize(); override;` |  | Sets the Height and Width for the image to the specified values.
`property Handle: HBITMAP; [rw]` |  | The operating system Handle associated with this bitmap.
`property HandleType: TBitmapHandleType; [rw]` |  | Handle type for the Bitmap.
`property Monochrome: Boolean; [rw]` |  | True when the image contains monochrome image data.
`end;`

## Inheritance

`TCustomBitmap` |  | TCustomBitmap - the base class for TBitmap.
`TRasterImage` |  | TRasterImage - base class for a number of graphic controls, including TCustomBitmap and TCustomIcon, which use a raster of dots to display graphic information.
`TGraphic` |  | Abstract base class used for images in supported image formats.
`TPersistent`
?
`TObject`

## Description

TCustomBitmap is a TRasterImage descendant which implements the base class for TBitmap. It contains image data using the .bmp (Windows bitmap) or .xpm (XPixMap) formats. Image data can be loaded from a file, stream, or resource. The loading routine automatically recognizes the format, and can be used to load images from a Delphi form streams (.dfm files).

When the handle is created, it is up to the widgetset interface (gtk, qt, win32, etc.) to automatically convert it to the best internal format for the platform. That is the reason the Handle is interface dependent. To access the raw image data, see TLazIntfImage in IntfGraphics.pas.

Do not create instances of TCustomBitmap; use the TBitmap descendant.