Name
CopyBrush -- clone a brush (V1.5)
Synopsis
[id] = CopyBrush(source, dest[, table])
Function
This function clones the brush specified by source and creates a copy of it in brush dest. The new brush is independent from the old brush so you could free the source brush after it has been cloned.

If you pass Nil as dest, CopyBrush() will return a handle to the new brush to you. Otherwise the new brush will use the identifier specified in dest.

Starting with Hollywood 5.0, this function accepts an optional table argument which accepts the following fields:

Hardware:
If you set this tag to 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)

Display:
If you specify the identifier of a display here, Hollywood will create a display-dependent hardware brush for you. Display-dependent hardware brushes can only be drawn to the display they belong to. This tag is only handled if the 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)

SmoothScale:
If you set this tag to True and the Hardware tag has also been set to True, Hollywood (or display adapters) will use bilinear interpolation when transforming the newly created brush. Normally, whether interpolation shall be used or not is set when calling a brush transformation command like ScaleBrush() or RotateBrush() but some display adapters need to know this information already at the time a hardware brush is created, and this is why this tag is here, though it's probably of not much use because it's only needed in rather special situations with display adapters like RebelSDL or hardware brushes on Android, because normally you can just specify whether interpolation shall be used or not in the transformation command directly. Note that SmoothScale is only supported when Hardware is set to True. (V8.0)

Inputs
source
source brush id
dest
identifier of the brush to be created or Nil for auto id selection
table
optional: table configuring further options (V5.0)
Results
id
optional: handle to the new brush; will only be returned if you specified Nil in dest
Example
CopyBrush(1, 10)
FreeBrush(1)
The above code creates a new brush 10 which contains the same graphics data as brush 1. Then it frees brush 1 because it is no longer needed.

Show TOC