Language Reference Guide : System Classes : BitmapObject Class : GradientBitmap Method
 
Share this page          
GradientBitmap Method
The GradientBitmap method creates a gradient and applies it to the bitmap. The gradient can be specified as a seed bitmap or as a pattern (with optional driftpattern).
Seed-based gradients may be as simple or as rich as required. Pattern-based bitmaps are currently linear only.
If the BitmapObject is attached to a FormField or a stored TaggedValue Item, using this in your program during development may change your frame's source definition. See BitmapObject Attributes and Methods Affecting the Frame Source (see BitmapObject Class).
This method has the following syntax:
integer = BitmapObject.GradientBitmap([start = integer]
          [, pattern = array of IntegerObject]
          [, driftpattern = array of IntegerObject | , seed = BitmapObject],
          width = integer, height = integer)
This method has the following parameters:
start
Specifies the side from which the gradient develops. Valid values are:
GF_LEFT
GF_TOP
GF_RIGHT
GF_BOTTOM
Default: GF_TOP
For more information about system constant settings, see GrowFrom Settings for BarFields and BitmapObjects.
pattern
(Either this parameter or seed is required.) Specifies the color sequence of the gradient as a series of color stops, defined as integer values in an array of IntegerObject; each integer is an RGB color.
Gradient specification generally follows the CSS standard, using the format:
start colorstop [colorstop]
where all colorstops are equally separated.
Note:  Use the seed parameter for more complex gradients or combine multiple bitmaps.
For example, if there are three pattern colorstops defined: red, green, blue—RGB(255, 0, 0), RGB(0, 255, 0), RGB(0, 0, 255)—then a bitmap width of 3 pixels, height of 5 pixels, from the top (GR_TOP) will have on the:
Top row: red
Second row: orange
Third row: green
Fourth row: turquoise
Fifth row: blue
driftpattern
Specifies a parallel pattern, providing gradient definition in the perpendicular dimension. If provided, there must be exactly the same number of driftpattern entries as pattern entries.
Thus for each color in the direction of the pattern of colors, there can be an adjacent color: if the start setting is GR_TOP, the adjacent colors are to the right of the pattern colors; if the start setting is GR_RIGHT, the adjacent colors are below the pattern colors.
For example, if there are three pattern colorstops defined: red, green, blue—RGB(255, 0, 0), RGB(0, 255, 0), RGB(0, 0, 255) —and three driftpattern colorstops defined: all black—RGB(0, 0, 0) —then a bitmap width of 3 pixels, height of 5 pixels, starting from the top (GR_TOP) will have:
On the top row: red, dark-red, black
On the second row: orange, dark-orange, black
On the third row: green, dark-green, black
On the fourth row: turquoise, dark-turquoise, black
On the fifth row: blue, dark-blue, black
seed
(Either this parameter or pattern is required.) Specifies a source BitmapObject, already patterned, to be resized to the specified width and height to provide the gradient.
This bitmap can be as simple or complex as desired. For example, it could consist of exactly 2 pixels, startcolor and endcolor, to provide a one-dimensional gradient; or it could be larger than the gradient bitmaps that will be generated from it. The resizing uses a bilinear algorithm to ensure a smooth gradient.
width
Specifies the width of the patterned bitmap to be generated, in pixels.
height
Specifies the height of the patterned bitmap to be generated, in pixels.
This method changes and returns the BitmapObject itself. The BitmapObject's ErrorStatus is set to any error code.