Name
CreateGradientBGPic -- create a new background picture with a gradient (V2.0)
Formerly known as
CreateRainbowBGPic (V1.0 - V1.9)

Synopsis
[id] = CreateGradientBGPic(id, type, startcolor, endcolor[, width,
                           height, angle, table])
Function
This function can be used to create a new background picture with a gradient on it. If you specify Nil in the id argument, this function will choose an identifier for this background picture automatically and return it to you. type specifies the type of the gradient you want to use. The following gradient types are currently available: #LINEAR, #RADIAL, and #CONICAL. If width and height are omitted, the dimensions will be set to the same as the current display's dimensions. The angle parameter 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. (V5.0)

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. (V5.0)

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. (V5.0)

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. (V5.0)

Inputs
id
id for the new background picture or Nil for auto ID select
type
type of the gradient; see above for available types
startcolor
RGB value defining the start color
endcolor
RGB value defining the end color
width
optional: desired width for the background picture (default: current display width)
height
optional: desired height for the background picture (default: current display height)
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 BGPic; will only be returned when you pass Nil as argument 1 (see above)
Example
CreateGradientBGPic(2, #LINEAR, #BLACK, #BLUE)
DisplayBGPic(2)
Creates a top to bottom gradient as background picture 2 with a color fade from black to blue and displays it.


CreateGradientBGPic(2, #LINEAR, 0, 0, 640, 480, 0, {Colors = {#RED, 0,
    #BLUE, 0.25, #GREEN, 0.5, #YELLOW, 0.75, #BLACK, 1}})
DisplayBGPic(2)
The code above creates a gradient containing multiple color stops. This gradient tries to replicate the look of the famous Amiga copper bars.

Show TOC