ImageEn, unit iexBitmaps

TIEBitmap.EncapsulateTBitmap

TIEBitmap.EncapsulateTBitmap

Declaration

procedure EncapsulateTBitmap(obj: TBitmap; DoFreeImage: Boolean);

Description

Encapsulates an existing TBitmap object. It is useful to pass a TBitmap object to routines that require a TIEBitmap. Any changes to the TIEBitmap will be reflected in the TBitmap.
Supports only TBitmap with PixelFormat pf1bit, pf8bit, pf24bit, pf32bit. Other types will raise an exception.

Note:
The TBitmap is not owned by TIEBitmap. Destroying the TIEBitmap will not free obj. Free the TBitmap yourself (or keep it owned by its parent component).
If DoFreeImage is True, any previous image content held by this TIEBitmap is freed before encapsulating obj (it does not take ownership of obj).
If the TBitmap.PixelFormat is pfDevice, it must be set to a valid alternative, such as pf24bit

Example

bmp := TIEBitmap.Create();
try
  bmp.EncapsulateTBitmap( MyBitmap, False );
  RotateMyIEBitmap( bmp );
finally
  FreeAndNil( bmp );  // does not free MyBitmap
end;