[id] = ConvertToBrush(sourcetype, sourceid, dest[, t])
Having graphics as brushes is so convenient because brushes are the most flexible graphics type in Hollywood. Most of the image manipulating functions work only with brushes. That is why you will often want to convert your graphics data to the brush format.
The sourcetype
argument specifies the type of the source object that shall
be converted into a brush. It can be one of the following types:
#ANIM
Frame
tag in the optional table argument (see below).
#BGPIC
#BRUSH
#ICON
Frame
tag of the optional table argument
to specify the index of the image that should be converted to a brush.
By default, the first image in the icon will be converted to a brush. You
can also use the Selected
tag of the optional table argument to specify
whether or not the selected icon image should be converted to a brush.
By default, the normal image will be converted to a brush. (V8.0)
This type requires
you to pass the optional argument par
which must be set to the index
of icon image you wish to have converted into a brush. Icon image
indices are counted from 1 until the number of images in the icon.
Additionally, you can specify the optional argument par2
: If you
set this to True
, the selected icon image will be converted to a
brush, otherwise the normal image will be converted to a brush, which
is also the default mode. (V8.0)
#LAYER
Frame
tag in the optional table argument to specify which
frame of the anim layer should be converted to a brush (see below).
By default, the first frame will be converted.
#SPRITE
Frame
tag in the optional
table argument (see below).
#TEXTOBJECT
#VECTORPATH
sourceid
argument is unused. Instead, you need
to pass a table argument in the Path
tag in the optional table
argument. This table must contain information about the individual
paths to be embedded inside the new vector brush. The table uses the
same layout as the table you have to pass to the PathToBrush()
function. See PathToBrush for details. (V7.0)
The optional table argument allows you to pass the following additional options:
Frame:
Selected:
#ICON
, you can use this tag to specify whether the
selected or normal image should be converted to a brush. Icon images have
two states: normal and selected. If you set Selected
to True
, the selected
image will be converted to a brush. Otherwise ConvertToBrush()
will convert
the normal image to a brush. Defaults to False
. (V8.0)
Path:
#VECTORPATH
, you must set this tag to a table which
contains information about the individual paths to be embedded inside the
new vector brush. The table uses the same layout as the table you have to
pass to the PathToBrush() function. See PathToBrush for details.
(V7.0)
Vector:
ConvertToBrush()
will convert vector images to raster brushes.
If you want to convert them to vector brushes, set this tag to True
. This
makes it possible to convert vector text objects or vector anim frames to
vector brushes that can be scaled and rotated without any quality losses.
Defaults to False
. (V10.0)
dest
ConvertToBrush(#SPRITE, 1, 10, {Frame = 5})The code above creates a new brush with the id 10 from frame 5 of sprite number 1.