ImageEn, unit iexBitmaps

TIEBitmap.CopyFromTBitmap

TIEBitmap.CopyFromTBitmap


Declaration

procedure CopyFromTBitmap(Source: TBitmap);


Description

Copies the image from the Source TBitmap object.
Permitted values for source PixelFormat are: pf1bit, pf4bit, pf8bit, pf15bit, pf16bit, pf24bit, pf32bit, pfDevice (pfDevice images will be treated as pf24bit).
If Location is ieTBitmap, then only pf1bit and pf24bit and pf32bit are accepted.

Note: To access the alpha channel of 32bit (RGBA) bitmap images, call SynchronizeRGBA( True, True ); after CopyFromTBitmap(), which will fill AlphaChannel


Example

// Display the same image as a TImage
ImageEnView1.IEBitmap.CopyFromTBitmap( Image1.Picture.Bitmap );
ImageEnView1.Update();

// Copy 32bit BMP to TIEBitmap with Alpha
iebmp := TIEBitmap.Create();
bmp := TBitmap.create;
... Get 32bit Bitmap, e.g. bmp.LoadFromFile('D:\BMP32.bmp');
iebmp.CopyFromTBitmap( bmp );
iebmp.SynchronizeRGBA( True, True ); // Convert 32bit RGBA to 24bit Image + Alpha channel
iebmp.Write( 'D:\Alpha.png' );
bmp.Free;
iebmp.Free;


See Also

- SynchronizeRGBA
- BMP_HandleTransparency
- CopyToTBitmap


TIEBitmap Assignment and Drawing Methods

TIEBitmap Methods
Method Mode Notes
Assign From TIEBitmap/TBitmap/TGraphic/TIcon Copy whole image
AssignImage From TIEBitmap Like assign, but does not copy the alpha channel
AssignRect From TIEBitmap/TBitmap Copy a specified rect
CopyAndConvertFormat From TIEBitmap Copy whole image
CopyRectTo To TIEBitmap Copy rect to another image (without scaling)
CopyWithMask1 To TIEBitmap Copy image using a mask to specify what is copied from the source
CopyWithMask2 To TIEBitmap Copy image using a mask to specify what is replaced in the destintation
DrawToTIEBitmap To TIEBitmap Copies all or part of the image to a specified position and/or size
JoinBitmaps From two TIEBitmaps Draws two bitmaps to a single bitmaps
MergeAlphaRectTo With TIEBitmap Merges all or part of two TIEBitmaps with alpha channels to a specified position using merge rules
MergeWithAlpha With TIEBitmap Merges all or part of two TIEBitmaps with alpha channels to a specified position
RenderToTIEBitmapEx To TIEBitmap Extended drawing of content to a TIEBitmap
StretchRectTo To TIEBitmap Copy rect to dest rect in another image (with scaling)
SwitchTo To TIEBitmap Move content from one TIEBitmap to another

TBitmap Methods
Method Mode Notes
Assign From TIEBitmap/TBitmap/TGraphic/TIcon Copy whole image
AssignRect From TIEBitmap/TBitmap Copy a specified rect
CopyFromTBitmap From TBitmap Copy whole image
CopyToTBitmap To TBitmap Copy whole image
RenderToTBitmapEx To TBitmap Extended drawing of content to a TBitmap

TCanvas Methods
Method Mode Notes
DrawToCanvas To TCanvas Copies whole image to canvas at specified position (ignoring the alpha channel)
DrawToCanvasWithAlpha To TCanvas Copies whole image to canvas at specified position (honoring the alpha channel)
RenderToCanvas To TCanvas Extended drawing of content to a TCanvas (ignoring the alpha channel)
RenderToCanvasWithAlpha To TCanvas Extended drawing of content to a TCanvas (honoring the alpha channel)