[id] = LoadBrush(id, filename$[, table])
filename$
into memory and
assigns the identifier id
to it. If you pass Nil in id
, LoadBrush()
will automatically choose an identifier and return it.
Image formats that are supported on all platforms are PNG, JPEG, BMP,
IFF ILBM, GIF, and image formats you have a plugin for. Depending on the
platform Hollywood is running on, more image formats might be supported.
For example, on Amiga compatible systems Hollywood will be able to open all
image formats you have datatypes for as well. On Windows, LoadBrush()
can also
load image formats supported by the Windows Imaging Component.
Starting with Hollywood 5.0, this function can also load vector formats
like SVG if you have an appropriate plugin installed. Keep in mind, though,
that when you load vector images using LoadBrush()
, the brush will be a
special vector brush which does not support all features of the normal
brushes. You can, however, convert vector brushes to raster brushes by
using the RasterizeBrush() function.
See Vector brushes for more information on vector brushes.
The third argument is optional. It is a table that can be used to set further options for the loading operation. The following fields of the table can be used:
Transparency:
LoadAlpha:
True
if the alpha channel of the image
shall be loaded, too. Please note that not all pictures have
an alpha channel and that not all picture formats are capable
of storing alpha channel information. It is suggested that
you use the PNG format if you need alpha channel data. This
field defaults to False
.
X, Y, Width, Height:
Hardware:
True
, Hollywood will create this brush entirely
in video memory for hardware-accelerated drawing in connection with
a hardware double buffer. Hardware brushes are subject to several
restrictions. See hardware brushes for details. (V5.0)
ScaleWidth, ScaleHeight:
SmoothScale:
ScaleWidth
or ScaleHeight
is set, you can use this item to specify
whether or not Hollywood shall use anti-aliased scaling. Defaults to False
which means no anti-aliasing. Note that anti-aliased scaling is much slower
than normal scaling. (V5.3)
Display:
Hardware
tag has been set to True
. Also note that Hollywood's inbuilt
display adapter does not support display-dependent hardware brushes,
but plugins can install custom display adapters which support display-dependent
hardware brushes. This tag defaults to the identifier of the currently active display.
See hardware brushes for details. (V6.0)
Loader:
Adapter:
LoadTransparency:
True
, the monochrome transparency of the image will
be loaded. Please note that this tag is specifically designed for monochrome
transparency channels, i.e. a transparent pen in a palette-based image. If
you want to load the alphachannel of an image, set the LoadAlpha
tag to
True
. This tag defaults to False
. (V6.0)
LoadPalette:
True
, Hollywood will load the brush as a palette brush.
This means that you can get and modify the brush's palette which is useful
for certain effects like color cycling. You can also make pens transparent using
the TransparentPen
tag (see below) or the LoadTransparency
tag (see above).
Palette brushes also have the advantage of requiring less memory because 1 pixel
just needs 1 byte of memory instead of 4 bytes for 32-bit images. This tag
defaults to False
. (V9.0)
TransparentPen:
LoadPalette
tag has been set to True
(see above), the TransparentPen
tag can be used to define a pen that should be made transparent. Pens are counted
from 0. Alternatively, you can also set the LoadTransparency
tag to True
to force Hollywood to use the transparent pen that is stored in the image file
(if the image format supports the storage of transparent pens). This tag defaults
to #NOPEN
. (V9.0)
UserTags:
Please note that the Transparency
, LoadTransparency
and LoadAlpha
fields are mutually
exclusive. A brush can only have one transparency setting!
This command is also available from the preprocessor: Use @BRUSH to preload brushes!
LoadBrush(2, "MyBrush.png", {Transparency = #RED})This loads "MyBrush.png" as brush 2 with the color red being transparent.