Name
CreateGradientBrush -- create brush with gradient fill (V5.0)
Synopsis
[id] = CreateGradientBrush(id, width, height, type, startcolor,
                           endcolor[, angle, table])
Function
This function can be used to create a new brush which is initialized to a gradient backfill. If you specify Nil in the id argument, this function will choose a vacant identifier for this brush automatically and return it to you. The width and height arguments specify the desired dimensions for the new brush. The type argument specifies the type of the gradient you want to use. The following gradient types are currently available: #LINEAR, #RADIAL, and #CONICAL. The angle argument allows you to specify a rotation angle (in degrees) for the gradient. The angle argument is only supported by gradients of type #LINEAR and #CONICAL. Radial gradients cannot be rotated.

The optional table argument can be used to specify advanced options. The following tags are currently recognized:

CenterX, CenterY:
These two tags can be used to specify the center point of the gradient. As linear gradients do not have a center point, these two tags are only handled when you use gradients of type #RADIAL or #CONICAL. The center point must be specified as a floating point value that is between 0.0 (left/top corner) and 1.0 (right/bottom corner). If not specified, both tags default to 0.5 which means that the center point of the gradient is in the center of the image.

Border:
This tag can be used to set the border size for gradients of type #RADIAL. For the other gradient types this tag is ignored. The border size of the radial gradient must be a floating point value between 0.0 and 1.0. Defaults to 0.0 which means no border.

Balance:
This tag can be used to set the balance point for gradients of type #CONICAL. For the other gradient types this tag is ignored. The balance point of the conical gradient must be floating point value between 0.0 and 1.0. Defaults to 0.5. Note that this is only used when creating a two-color gradient. When creating a multi-color gradient using the Colors table, Balance is ignored because the Colors table allows you to individually balance the colors in the gradient using color stops.

Colors:
This tag allows you to create gradients that contain multiple colors. This tag must be set to a table that contains a sequence of alternating color and stop values. The colors must be specified in RGB format. The stop value is a floating point value between 0.0 and 1.0 and defines the position where the corresponding color should be merged into the gradient. A position of 0.0 means the start position of the gradient, and a position of 1.0 means the end position. Please note that the stop positions must be sorted in ascending order, i.e. starting from 0.0 to 1.0. If you specify this tag, the colors specified in the startcolor and endcolor arguments are ignored, and Hollywood will only use the colors specified in this tag.

Inputs
id
id for the new brush or Nil for auto ID select
width
desired width for the new brush
height
desired height for the new brush
type
type of the gradient; see above for available types
startcolor
RGB value defining the start color
endcolor
RGB value defining the end color
angle
optional: rotation angle for the gradient (default: 0)
table
optional: table argument specifying further options; see above for a description of available options
Results
id
optional: identifier of the brush; will only be returned when you pass Nil as argument 1 (see above)
Example
See CreateGradientBGPic


Show TOC