Linear gradient initialization and control functions
This part of the API performs linear gradient operations.
A color gradient (color progression, color ramp) is a smooth transition between a set of colors (color stops) that is done along a line (linear, or axial color gradient) or radially, along concentric circles (radial color gradient). The color transition is done by linear interpolation between two consecutive color stops.
Note: VGLite supports linear color gradients for GCNanoLiteV
and GCNanoUltraV
. Both linear and radial gradients are supported with GC355 and GC555.
vg_lite_init_grad
function
Description:
This function initializes the internal buffer for the linear gradient object with default settings for rendering.
Syntax:
vg_lite_error_t vg_lite_init_grad (
vg_lite_linear_gradient_t *grad
);
Parameters:
Parameter |
Description |
---|---|
|
Pointer to the vg_lite_linear_gradient_t structure, which defines the gradient to be initialized. Default values are used. |
Returns:
Returns VG_LITE_SUCCESS
if successful. See vg_lite_error_t enum for other return codes.
Parent topic:Linear gradient initialization and control functions
vg_lite_clear_grad
function
Description:
This function is used to clear the values of a linear gradient object and free up the memory of the image buffer.
Syntax:
vg_lite_error_t vg_lite_clear_grad (
vg_lite_linear_gradient_t *grad
);
Parameters:
Parameter |
Description |
---|---|
|
Pointer to the vg_lite_linear_gradient_t structure that is to be cleared |
Returns:
Returns VG_LITE_SUCCESS
if successful. See vg_lite_error_t enum for other return codes.
Parent topic:Linear gradient initialization and control functions
vg_lite_set_grad
function
Description:
This function is used to set values for the members of the vg_lite_linear_gradient_t
structure.
Note: The vg_lite_set_grad
API adopts the following rules to set the default gradient colors if the input parameters are incomplete or invalid:
If no valid stops have been specified (for example, due to an empty input array, out-of-range or out-of-order stops), a stop at 0 with (R, G, B, A) color (0.0, 0.0, 0.0, 1.0) (opaque black) and a stop at 1 with color (1.0, 1.0, 1.0, 1.0) (opaque white) are implicitly defined
If at least one valid stop has been specified, but none has been defined with an offset of 0, then an implicit stop is added with an offset of 0 and the same color as the first user-defined stop
If at least one valid stop has been specified, but none has been defined with an offset of 1, then an implicit stop is added with an offset of 1 and the same color as the last user-defined stop
Syntax:
vg_lite_error_t vg_lite_set_grad (
vg_lite_linear_gradient_t *grad,
uint32_t count,
uint32_t *colors,
uint32_t *stops
);
Parameters:
Parameter |
Description |
---|---|
|
Pointer to the vg_lite_linear_gradient_t structure to be set |
|
The number of colors in the linear gradient. The maximum color stop count is defined by |
|
Specifies the color array for the gradient stops. The color is in ARGB8888 format with alpha in the upper byte. |
|
Pointer to the gradient stop offset |
Returns:
Always returns VG_LITE_SUCCESS
.
Parent topic:Linear gradient initialization and control functions
vg_lite_get_grad_matrix
function
Description:
This function is used to get a pointer to the transformation matrix of the gradient object. It allows an application to manipulate the matrix to facilitate correct rendering of the gradient path.
Syntax:
vg_lite_error_t vg_lite_get_grad_matrix (
vg_lite_linear_gradient_t *grad
);
Parameters:
Parameter |
Description |
---|---|
|
Pointer to the vg_lite_linear_gradient_t structure, which contains the matrix to be retrieved |
Returns:
Returns VG_LITE_SUCCESS
if successful. See vg_lite_error_t enum for other return codes.
Parent topic:Linear gradient initialization and control functions
vg_lite_update_grad
function
Description:
This function is used to update or generate values for an image object that is going to be rendered. The vg_lite_linear_gradient_t
object has an image buffer, which is used to render the gradient pattern. The image buffer is created or updated with the corresponding gradient parameters.
Syntax:
vg_lite_error_t vg_lite_update_grad (
vg_lite_linear_gradient_t *grad
);
Parameters:
Parameter |
Description |
---|---|
|
Pointer to the vg_lite_linear_gradient_t structure, which contains the update values to be used for the object to be rendered |
Returns:
Returns VG_LITE_SUCCESS
if successful. See vg_lite_error_t enum for other return codes.
Parent topic:Linear gradient initialization and control functions
Parent topic:Vector-dased draw operations