ImageEn, unit imageenview |
|
TImageEnView.LayersMergeAll
Declaration
procedure LayersMergeAll(AlphaCompositing: Boolean = False);
Description
Merge all layers into a single background image layer.
When
AlphaCompositing is False then this method performs the same task as
LayersDrawTo, but replaces all layers with the merged result.
This method is fast and works with all layer options, so should be used to merge layers before printing or saving. However, it does not support transparency.
When
AlphaCompositing is True the result is equivalent to calling
LayersMerge([]).
LayersMergeFilter will specify the quality of image layers, if they do not have a custom
UseResampleFilter. Use this option if you require background transparency.
Note: Use
AlphaCompositing = True if you need to support background transparency
// Apply a "Paid" stamp to image
with ImageEnView1 do
begin
LayersAdd( 'PAID', 42, clRed, 'Arial Black', [fsBold] );
CurrentLayer.Rotate := 30;
TIETextLayer( CurrentLayer ).SizeToText();
CurrentLayer.PosX := IELayer_Pos_HCenter;
CurrentLayer.PosY := IELayer_Pos_VCenter;
LayersMergeAll();
end;
// Load an image, add text with a soft shadow and save it
var
iev : TImageEnView;
begin
iev := TImageEnView.Create( nil );
iev.IEBitmap.LoadFromFile( 'd:\image.jpg' );
iev.LayersAdd( ielkText, 100, 100 );
TIETextLayer( iev.CurrentLayer ).Text := 'This is a test';
TIETextLayer( iev.CurrentLayer ).Font.Size := 30;
TIETextLayer( iev.CurrentLayer ).Font.Style := [fsBold];
iev.CurrentLayer.SoftShadow.Enabled := True;
iev.LayersMergeAll();
iev.IEBitmap.SaveToFile( 'd:\image_out.jpg' );
iev.Free();
end;
// Create a PNG with a 50% transparent ellipse
ImageEnView1.Blank;
aRect := Rect( 0, 0, 200, 200);
ImageEnView1.LayersAdd( iesEllipse, aRect, clNone, 0, clRed );
ImageEnView1.CurrentLayer.Opacity := 0.5;
// Merge with Alpha Compositing
ImageEnView1.LayersMergeAll( True );
ImageEnView1.IO.SaveToFile( 'D:\out.png');
See Also
◼LayersMerge
◼LayersMergeFilter
◼LayersMergeTo
◼IELayersMerge
◼LayersSaveMergedTo