MergeLayers(layer1[, layer2, ..., t])
layer1
, layer2
, etc. into a new layer
while preserving the source layers. By default, MergeLayers()
will automatically
hide the source layers, but this behaviour can be changed by setting the AutoHide
tag to False
in the optional table argument. Instead of single layers, you can also
pass layer groups that should be merged to this function.
The new layer that is created by MergeLayers()
will use the special #MERGED
layer type.
Layers of type #MERGED
can't be transformed (except by the layer scaling engine) and
they'll typically contain all settings of their child layers, e.g. shadow, border, filters,
transparency settings etc. rendered into the layer, although this can be changed using
certain tags in the optional table argument. In comparison to layer groups created
using GroupLayer(), one advantage of merged layers is that when showing them using
transition effects they will be treated as a whole whereas showing layers that are part of a
group created by GroupLayer() using transition effects would apply the transitions
to each group member individually which might not always look as good as when the transitions
are applied to the layers as a whole. This limitation of GroupLayer() can thus be
overcome by using MergeLayers()
.
The optional table argument t
can contain the following tags:
AutoHide:
MergeLayers()
.
By default, MergeLayers()
will automatically hide the layers that are merged into a
new one. If you don't want that, set this tag to False
. Defaults to True
.
MergeShadow:
True
. If you set this to False
, no shadow effect from any of
the source layers will be merged into the new layer so the new layer will appear without any
shadow. Of course, it's possible to add a shadow to the new layer using SetLayerShadow()
or the standard drawing tags.
MergeBorder:
True
. If you set this to False
, no border effect from any of
the source layers will be merged into the new layer so the new layer will appear without any
border effect. Of course, it's possible to add a border effect to the new layer using SetLayerBorder()
or the standard drawing tags.
MergeFilter:
True
. If you set this to False
, no filter from any of
the source layers will be merged into the new layer so the new layer will appear without any
filters. Of course, it's possible to add filters to the new layer using SetLayerFilter()
or the standard drawing tags.
MergeTransparency:
True
. If you set this to False
, no transparency from any of
the source layers will be merged into the new layer so the new layer will appear without any
transparency setting. Of course, it's possible to set the transparency of the new layer using
SetLayerTransparency() or the standard drawing tags.
MergeFX:
True
. If you set this to False
, no transition effect from any of
the source layers will be merged into the new layer so the new layer will appear without any
transition effects.
Furthermore, the optional table argument also supports Hollywood's standard drawing tags. See Standard drawing tags for more information about the standard tags that nearly all Hollywood drawing commands support.
Note that merged layers aren't updated automatically when their source layers change their
graphics. You need to use the RefreshLayer() function to force an update of a merged
layer. See RefreshLayer for details. Also note that only visible layers will be merged. Hidden layers
will be ignored by MergeLayers()
.
You need to enable layers before you can use GroupLayer(). See Layers introduction for details.
EnableLayers SetFillStyle(#FILLCOLOR) SelectBGPic(1) Box(0, 0, 100, 100, #RED) Box(100, 0, 100, 100, #GREEN) Box(200, 0, 100, 100, #BLUE) MergeLayers(1, 2, 3, {Name = "newlayer", Hidden = True}) MoveLayer("newlayer", #CENTER, #CENTER) EndSelect ShowLayerFX("newlayer", #ZOOMCENTER)The code above creates three hidden 100x100 rectangles, merges them to a new layer, moves this new layer to the center and then shows the merged layer with a transition effect. Note that we use SelectBGPic() to make sure nothing is drawn before our call to ShowLayerFX().