ImageEn, unit imageenview

TImageEnView.LayersMerge

TImageEnView.LayersMerge


Declaration


procedure LayersMerge(); overload;
procedure LayersMerge(Layer1, Layer2: integer; RemoveUpperLayer: Boolean = true); overload;
procedure LayersMerge(LayerList: array of integer); overload;
procedure LayersMerge(LayerList: TIEArrayOfInteger); overload;


Description


Merges two or more layers into one layer. The new layer has the lesser index.
The new layer will inherit the Layers.Transparency and the bitmap's alpha channels.
The LayersMerge() overload (without parameters) will merge selected layers.

Notes:
- To merge a layer with its own mask (to create a layer with the transparency of the mask) pass only two indexes (i.e. the indexes of the layer and the mask).
- If any of the layers are not a TIEImageLayer, they will be converted to a TIEImageLayer
- LayersMergeFilter will specify the quality of image layers, if they do not have a custom UseResampleFilter

Parameter Description
Layer1 Index of the first layer to merge.
Layer2 Index of the second layer to merge.
RemoveUpperLayer If RemoveUpperLayer is false, the upper layer will not be removed.
LayerList An array of layer indexes to remove. The array must be ordered and all layers will be merged into the layer specified by the first index. Empty list means "all layers".



Example


// Merge layer 1 with background (layer 0)
ImageEnView1.LayersMerge([ 1, 0 ]);

// Merge layers 0, 1 and 2
ImageEnView1.LayersMerge([ 0, 1, 2 ]);

// Merge all layers
ImageEnView1.LayersMerge([]);

// Merge all selected layers
ImageEnView1.LayersMerge();

// Merge layer 1 with its mask
ImageEnView1.LayersMerge( 1, 2 );

// we want to get a background image and then merge over it another image in semi-transparency.
ImageEnView.IO.LoadFromFile('C:\background.jpg');
ImageEnView.LayersAdd;
ImageEnView.IO.LoadFromFile('C:\foreground.jpg');
ImageEnView.Layers[1].Transparency := 128; // the second layer has 50% transparency
ImageEnView.LayersMerge(0, 1); // from now we have only one layer
ImageEnView.IO.SaveToFile('C:\output.jpg');


See Also


- LayersMergeAll
- LayersMergeFilter
- LayersMergeTo
- IELayersMerge
- LayersSaveMergedTo