Sign in Join
FPDoc Onlineexperiment

TBitmap class

In unit Graphics

Implements a FCL-compatible reader/writer for a Bitmap image.

Declaration

pascal
TBitmap = class(TFPImageBitmap)

Inheritance

  1. TBitmap
  2. TFPImageBitmap
  3. TCustomBitmap
  4. TRasterImage
  5. TGraphic
  6. TPersistent

Description

TBitmap is a TFPImageBitmap descendant which represents the data for a Bitmap image. The image can be loaded from a file, stream or resource which uses .bmp (windows bitmap) format.

TBitmap provides overridden methods which get the image reader (TLazReaderBMP) and writer (TLazWriteBMP) class references, as well as the shared image storage class (TSharedBitmap).

An overridden LoadFromStream method is provided which handles reading the BMP header using the correct endian-ness for the platform. The loading routine automatically recognizes the format, so it is also used to load the images from Delphi form streams (e.g. .dfm files) or FreePascal/Lazarus form streams (.lfm).

When the handle for the image is created, it is up to the interface (GTK, QT, Win32,etc.) to convert it automatically to the best internal format for the widgetset. That is why the Handle is interface dependent.

To access the raw image data, see TLazIntfImage.

Please note that the current implementation is dramatically different than previous LCL implementations. Most of the low-level functionality for TBitmap has been refactored into ancestor or descendent classes.

See also

Methods

InitializeReaderprotectedInitializes the image reader to use the transparency settings in the class instance.
GetReaderClassprotectedGets the class reference used to create the FCL-compatible reader for the image.
GetWriterClassprotectedGets the class reference used to create instances of the FCL-compatible image writer.
GetSharedImageClassprotectedGets the class reference used to create new instances of a shared image.
GetFileExtensionspublicGets the file extensions supported for the image type.
GetResourceTypepublicGets the resource type identifier for the image format.
LoadFromStreampublicLoads image data for the bitmap from the specified stream.

Inherited

From TFPImageBitmap (9)

FinalizeReader FinalizeWriter GetMimeType InitializeWriter IsFileExtensionSupported IsStreamFormatSupported LazarusResourceTypeValid ReadStream WriteStream

From TCustomBitmap (35)

Assign BitmapHandleAllocated CanShareImage Changed Clear Create CreateDefaultBitmapHandle Destroy FreeImage FreeMaskHandle GetBitmapHandle GetMaskHandle GetPalette GetPixelFormat GetRawImageDescriptionPtr GetRawImagePtr Handle HandleNeeded HandleType InternalReleaseBitmapHandle InternalReleaseMaskHandle InternalReleasePalette MaskHandleAllocated MaskHandleNeeded Monochrome PaletteAllocated PaletteNeeded RawimageNeeded ReleaseHandle SetHandle SetHandles SetPixelFormat SetSize UnshareImage UpdateHandles

From TRasterImage (46)

ApplyTransparent BeginUpdate BitmapHandle BitmapHandleNeeded Canvas CreateIntfImage Draw EndUpdate FreeSaveStream GetEmpty GetHandle GetHeight GetMasked GetSize GetSupportedSourceMimeTypes GetTransparent GetWidth HandleAllocated LoadFromBitmapHandles LoadFromDevice LoadFromIntfImage LoadFromMimeStream LoadFromRawImage Mask Masked MaskHandle PixelFormat RawImage ReadData ReleaseBitmapHandle ReleaseMaskHandle ReleasePalette RequestTransparentColor SaveStreamNeeded SaveToStream ScanLine SetBitmapHandle SetHeight SetMasked SetMaskHandle SetTransparent SetTransparentMode SetWidth TransparentColor TransparentMode WriteData

From TGraphic (24)

DefineProperties Empty Equals Height LoadFromClipboardFormat LoadFromClipboardFormatID LoadFromFile LoadFromLazarusResource LoadFromResourceID LoadFromResourceName MimeType Modified OnChange OnProgress Palette PaletteModified Progress SaveToClipboardFormat SaveToClipboardFormatID SaveToFile SetModified SetPalette Transparent Width

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.