Declaration
procedure CopyToBitmap(var Dest: TIEBitmap; CreateWidth : Integer = -1; CreateHeight : Integer = -1; EnableAlpha: Boolean = True; UseDisplayAR: Boolean = True); virtual; abstract;
Description
Creates a bitmap representation of the current layer.
You do not need to create
Dest. It will be automatically created and sized as required.
If
CreateWidth and
CreateHeight are not specified, the bitmap will be created at the current size of the layer.
Set
EnableAlpha to false if you do not want as alpha channel applied to
Dest.
If
UseDisplayAR is true, then the image will be returned with the same aspect ratio it is displayed, If false, it is stretched to the specified CreateWidth and CreateHeight dimensions.
Note:
◼You must free
Dest◼TIEImageLayers will return an unrotated bitmap, even if
Rotate is specified
// Save the current layer as an image
var
bmp: TIEBitmap;
Begin
ImageEnView1.CurrentLayer.CopyToBitmap( bmp );
bmp.SaveToFile( 'D:\MyLayer.jpg' );
bmp.Free();
end;
// Assign Layer 1 to another ImageEnView
var
bmp: TIEBitmap;
begin
bmp := TIEBitmap.create;
ImageEnView1.Layers[1].CopyToBitmap( bmp, ImageEnView2.ClientWidth, ImageEnView2.ClientHeight );
ImageEnView2.IEBitmap.Assign( bmp );
ImageEnView2.Update;
bmp.Free();
end;
// Show a preview in ImageEnView2 of the layer selected in ImageEnView1
procedure Tfmain.ImageEnView1LayerSelectionChange(Sender: TObject);
var
bmp: TIEBitmap;
begin
bmp := ImageEnView2.IEBitmap;
ImageEnView1.CurrentLayer.CopyToBitmap( bmp, ImageEnView2.IdealImageWidth, ImageEnView2.IdealImageWidth );
ImageEnView2.Update();
end;
See Also
◼Bitmap◼DrawToCanvas