Linear gradient extended functions

The following functions are available only with IP that includes hardware support for extended linear gradient capabilities, such as GC355 and GC555. These functions are not available with GCNanoLiteV, GCNanoUltraV, or GCNanoV. Applications can use VGLite API vg_lite_query_feature (gcFEATURE_BIT_VG_LINEAR_GRADIENT_EXT) to determine HW support for linear gradient.

vg_lite_set_linear_grad function

Description:

This function is used to set the values that define the linear gradient. (from April 2022)

Syntax:

vg_lite_error_t vg_lite_set_linear_grad (
    vg_lite_ext_linear_gradient_t          *grad,
    vg_lite_uint32_t                       count,
    vg_lite_color_ramp_t                   *color_ramp,
    vg_lite_linear_gradient_parameter_t    grad_param,
    vg_lite_radial_gradient_spreadmode_t   spread_mode,
    vg_lite_uint8_t                        pre_mult
);  

Parameters:

Parameter

Description

*grad

Pointer to the vg_lite_ext_linear_gradient_t structure that is to be set.

count

Count of the colors in the gradient. The maximum color stop count is defined by MAX_COLOR_RAMP_STOPS, which is set to 256.

*color_ramp

It is the array of stops for the linear gradient. The number of parameters for each stop is 5, and gives the offset and color of the stop. Each stop is defined by a floating-point offset value and four floating-point values containing the sRGBA color and alpha value associated with each stop, in the form of a non-premultiplied (R, G, B, alpha) quad. The range of all parameters is [0,1].

grad_param

Gradient parameters as specified in the structure vg_lite_linear_gradient_parameter_t.

spread_mode

The fill mode is applied to the pixels out of the paint after transformation. Uses the same spread mode enumeration types as radial gradient. For details, see vg_lite_radial_gradient_spreadmode_t enum.

pre_mult

This parameter controls whether color and alpha values are interpolated in premultiplied or non-premultiplied form.

Returns:

Returns VG_LITE_INVALID_ARGUMENTS to indicate the parameters are wrong.

Parent topic:Linear gradient extended functions

vg_lite_get_linear_grad_matrix function

Description:

This function returns a pointer to an extended linear gradient object’s matrix.(from March 2023).

Syntax:

vg_lite_matrix_t* vg_lite_get_linear_grad_matrix (
    vg_lite_ext_linear_gradient_t   *grad,
);  

Parameters:

Parameter

Description

*grad

Pointer to the vg_lite_ext_linear_gradient_t structure.

Returns:

Returns a pointer to vg_lite_matrix_t for the specified extended linear gradient.

Parent topic:Linear gradient extended functions

vg_lite_draw_linear_grad function

Description:

This function returns a pointer to an extended linear gradient object’s matrix.(from March 2023).

Syntax:

vg_lite_error_t vg_lite_draw_linear_grad (
    vg_lite_buffer_t                *target,
    vg_lite_path_t                  *path, 
    vg_lite_fill_t                  fill_rule, 
    vg_lite_matrix_t                *path_matrix, 
    vg_lite_ext_linear_gradient_t   *grad, 
    vg_lite_color_t                 paint_color,
    vg_lite_blend_t                 blend,
    vg_lite_filter_t                filter
); 

Parameters:

Parameter

Description

*target

Pointer to the vg_lite_buffer_t structure containing data describing the target path.

*path

Pointer to the vg_lite_path_t structure containing path data that describes the path to draw for the linear gradient. Refer to Vector path opcodes for plotting paths in this document for opcode detail.

fill_rule

Specifies the vg_lite_fill_t enum value for the fill rule for the path.

*path_matrix

Pointer to a vg_lite_matrix_t structure that defines the 3x3 transformation matrix of the path. If the matrix is NULL, an identity matrix is assumed; however, this option is not preferable.

*grad

Pointer to the vg_lite_ext_linear_gradient_t structure that contains the values to be used to fill the path. Note: grad->image.image_mode does not support VG_LITE_MULTIPLY_IMAGE_MODE.

paint_color

Specifies the paint color vg_lite_color_t RGBA value to be applied by VG_LITE_RADIAL_GRADIENT_SPREAD_FILL, set by function vg_lite_set_linear_grad. When pixels are out of the image after transformation, this paint_color is applied to them. For details, see enum vg_lite_radial_gradient_spreadmode_t.

blend

Specifies blend mode in the vg_lite_blend_t enum to be applied to each drawn pixel. If no blending is required, set this value to VG_LITE_BLEND_NONE (0).

filter

Specified the filter mode vg_lite_filter_t enum value to be applied to each drawn pixel. If no filtering is required, set this value to VG_LITE_BLEND_POINT (0).

Returns:

Returns VG_LITE_SUCCESS if successful. See vg_lite_error_t enum for other return codes.

Parent topic:Linear gradient extended functions

vg_lite_update_linear_grad function

Description:

This function is used to update or generate the corresponding image object to render (from April 2022).

The vg_lite_ext_linear_gradient_t object has an image buffer that is used to render the linear gradient paint. The image buffer is created/updated according to the specified grad parameters.

Syntax:

vg_lite_error_t vg_lite_update_linear_grad (
    vg_lite_ext_linear_gradient_t   *grad,
);  

Parameters:

Parameter

Description

*grad

Pointer to the vg_lite_linear_gradient_ext_t structure that is to be updated or created.

Returns:

Returns VG_LITE_SUCCESS if successful. See vg_lite_error_t enum for other return codes.

Parent topic:Linear gradient extended functions

vg_lite_clear_linear_grad function

Description:

This function is used to clear the linear gradient object. This resets the grad members and free the image buffer’s memory (from April 2022).

Syntax:

vg_lite_error_t vg_lite_clear_linear_grad (
    vg_lite_ext_linear_gradient_t    *grad,
);  

Parameters:

Parameter

Description

*grad

Pointer to the vg_lite_linear_gradient_ext_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 extended functions

Parent topic:Vector-dased draw operations