Function GraGradient() Foundation

Draws a shape filled with a gradient.

Syntax
GraGradient( [<oPS>], [<aStart>], <aVertices>, [<aColors>], [<nMode>] ) --> lSuccess
Parameters
<oPS>
The argument <oPS> specifies the presentation space in which the gradient is drawn. If the current window is an XbpCrt window, <oPS>is optional. If it is NIL, the return value of SetAppWindow():presSpace() is used. In all other cases <oPS> is not optional. It must be created either using XbpPresSpace():new() or a "Micro PS" must be requested from an Xbase Part using the method:lockPS(). After graphic output the Micro PS must be released with :unlockPS().
<aStart> := { <nX1>, <nY1> }
<aStart> is an array of two elements which determines the coordinates for the lower left corner of the gradient. The first element <nX1> designates the x coordinate and the second element <nY1> the y coordinate. The unit for the coordinates depends on the coordinate system defined for the presentation space. If no presentation space is specified, the values for the coordinates are given in pixels, which is the unit for a window. The origin for the coordinates (point {0,0}) is at the lower left. If <aStart> is not specified, the lower left corner of the rectangle is the current pen position.
<aVertices> := {{<nX2>,<nY2>}} | {{<nX2>,<nY2>},{<nX3>,<nY3>}}
<aVertices> contains an array which defines subsequent coordinates for the gradient. If a shaded rectangle is drawn, the end point for the rectangle must be specified in the format {{<nX2>,<nY2>}}.
If a triangle is to be filled with a gradient, two subsequent coordinates must be passed in <aVertices>. The array {<nX2>,<nY2>} defines the apex of the triangle whereas {<nX3>,<nY3>} specifies the end point for the operation.
[<aColors>]
Parameter <aColors> specifies the colors used for the gradient fill. The parameter is optional. If nothing is assigned to <aColors>, GraGradient() uses the colors specified using function GraSetAttrArea(). If a rectangle is drawn, two colors are used to define the gradient. In this mode, <aColors> contains two elements and is of the format {<xColor1>,<xColor2>}. If a triangle is drawn, three colors are used instead. In that case, <aColors> has the format {<xColor1>,<xColor2>,<xColor3>}.
The array elements may be specified using one of the predefined colors from the file GRA.CH, one of the system colors defined in XBP.CH, or using an RGB-triplet. See GraMakeRGBColor() for further information.
If parameter <aColors> is omitted, the default colors are determined using the following elements of the area attribute specification array: {GRA_AA_COLOR,GRA_AA_BACKCOLOR,GRA_AA_COLOR}.
[<nMode>]
<nMode> specifies one of the operating modes listed in the following table.
Operating modes for GraGradient()
Constant Description
GRA_GRADIENT_HORIZONTAL *) Draws a rectangle with a horizontal gradient
GRA_GRADIENT_VERTICAL Draws a rectangle with a vertical gradient
GRA_GRADIENT_TRIANGLE Draws a shaded triangle
  1. Default
Return
Description

Function GraGradient() draws a shape filled with a gradient. The function can be used to draw either shaded rectangles or triangles.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.