CreateLayer(x, y, width, height[, table])
width
/ height
and it
will appear at the specified position. This function will create either
a layer of type #BRUSH
or of type #ANIM
. If you want to create an anim
layer, you will have to pass the desired number of frames in the Frames
tag in the optional table argument.
The optional table argument recognizes the following tags:
Frames
CreateLayer()
will create a brush layer. Otherwise
an anim layer containing the specified number of frames will
be created. Defaults to 1 (which means that by default,
CreateLayer()
will create a brush layer).
Color
Mask
True
if CreateLayer()
should attach a
mask to the new layer. If this is True
, AlphaChannel
must be False
. Defaults to False
.
AlphaChannel
True
if CreateLayer()
should attach an
alpha channel to the new layer. If this is set to True
,
Mask
must be set to False
. Defaults to False
.
Clear
AlphaChannel
or
Mask
was set to True
. If that is the case, Clear
specifies whether or not the mask or alpha channel should
be cleared (i.e. fully transparent) or not (i.e. opaque).
This defaults to False
which means that by default, the
new mask or alpha channel will be opaque.
Additionally, you can pass one or more of the standard tags in the optional table argument. Using these tags you can for instance control the insert position of the layer, assign a name to it, and modify the anchor point settings of this layer. See Standard draw tags for details.
CreateLayer()
is the preferred way of creating an empty layer that you
later want to modify using the SelectLayer() command. Of course, you could
also create an empty brush using CreateBrush() and then insert it as
a layer using DisplayBrush() or InsertLayer() but this is not as effective
as using the new CreateLayer()
function because when you then call
SelectLayer() on a layer that was created from an existing brush source,
Hollywood first has to create a copy of the layer because SelectLayer()
shall only modify the layer contents and not the contents of the brush
that was used to create the layer. This is not very critical with brush
layers, but imagine an anim layer with some dozens of frames! Using
SelectLayer() on such an anim layer would be very expensive and would
take quite some time. In these cases, CreateLayer()
is really much more
effective.
CreateLayer(#CENTER, #CENTER, 100, 100, {Color = #RED}) SelectLayer(1) Circle(0, 0, 50, #WHITE) EndSelectThe code above creates a new 100x100 red layer and then draws a white circle onto it.