SelectBrush(id[, mode, combomode])
id
as the current output
device. This means that all graphics data that are drawn by Hollywood
will be rendered to your brush.
The optional mode
argument defaults to #SELMODE_NORMAL
which means
that only the color channels of the brush will be altered when you draw
to it. The transparency channel of the brush (can be either a mask or an
alpha channel) will never be altered. You can change this behaviour by
using #SELMODE_COMBO
in the optional mode
argument. If you use this
mode, every Hollywood graphics command that is called after SelectBrush()
will draw into the color and transparency channel of the brush. If the
brush does not have a transparency channel, #SELMODE_COMBO
behaves the
same as #SELMODE_NORMAL
.
Starting with Hollywood 5.0 you can use the optional combomode
argument
to specify how #SELMODE_COMBO
should behave. If combomode
is set to
0, the color and transparency information of all pixels in the source
image are copied to the destination image in any case - even if the
pixels are invisible. This is the default behaviour. If combomode
is set
to 1, only the visible pixels are copied to the destination image. This
means that if the alpha value of a pixel in the source image is 0, i.e. invisible,
it will not be copied to the destination image. Hollywood 6.0 introduces
the new combomode 2. If you pass 2 in combomode
, Hollywood will blend
color channels and alpha channel of the source image into the destination
image's color and alpha channels. When you draw the destination image later,
it will look as if the two images had been drawn on top of each other
consecutively. Please note that the combomode
argument is only supported
together with #SELMODE_COMBO
. It doesn't have any effect when used with the
other modes.
An alternative way to draw into the transparency channels of a brush is
to do this separately using SelectMask() or SelectAlphaChannel(). These
two commands, however, will write data to the transparency channel only.
They will not touch the color channel. So if you want both channels,
color and transparency, to be affected, you need to use SelectBrush()
with mode
set to #SELMODE_COMBO
.
When you are finished with rendering to your brush and want your display to become the output device again, just call EndSelect().
While SelectBrush()
is active, it is forbidden to call commands which
change the dimensions of the brush that is currently used as the output
device, e.g. you may not call ScaleBrush() to scale the brush that is
currently the output device.
Only Hollywood commands that draw graphics directly can be used when
SelectBrush()
is active. You may not call animated functions like
MoveBrush() or DisplayBrushFX() while SelectBrush()
is active.
#SELMODE_NORMAL
or #SELMODE_COMBO
; defaults to
#SELMODE_NORMAL
(V4.5)#SELMODE_COMBO
is active (see above);
defaults to 0 (V5.0)CreateBrush(1, 320, 256) SelectBrush(1) SetFillStyle(#FILLCOLOR) Box(0, 0, 320, 256, #RED) EndSelect() MoveBrush(1, #CENTER, #BOTTOMOUT, #CENTER, #TOPOUT, 10)The above code creates a 320x256 brush, draws a red rectangle into it and then scrolls the rectangle on the screen. This is very abstract example. You can of course do a lot of more with this command, just have a look at the examples supplied with the Hollywood distribution. They use
SelectBrush()
in
more advanced contexts.