Draw and gradient structures

This section provides an overview of the draw and gradient structures.

vg_lite_buffer_t structure

This structure is defined under the “Pixel buffer structures” section (see vg_lite_buffer_t structure).

Parent topic:Draw and gradient structures

vg_lite_color_ramp_t structure

This structure defines the stops for the radial gradient. The five parameters provide the offset and color for the stop. Each stop is defined by a set of floating point values which specify the offset and the sRGBA color and alpha values. Color channel values are in the form of a non-premultiplied (R, G, B, alpha) quad. All parameters are in the range of [0,1]. The red, green, blue, alpha value of [0, 1] is mapped to an 8-bit pixel value [0, 255].(from November 2020, requires GC355 hardware)

The define for the max number of radial gradient stops is #define MAX_COLOR_RAMP_STOPS256.

Used in radial gradient structure: vg_lite_radial_gradient_t.

vg_lite_color_ramp_t members

Type

Description

stop

vg_lite_float_t

Offset value for the color stop

red

vg_lite_float_t

Red color channel value for the color stop

green

vg_lite_float_t

Green color channel value for the color stop

blue

vg_lite_float_t

Blue color channel value for the color stop

alpha

vg_lite_float_t

Alpha color channel value for the color stop

Parent topic:Draw and gradient structures

vg_lite_linear_gradient_t structure

This structure defines the organization of a linear gradient in VGLite data. The linear gradient is applied to filling a path. It generates a 256x1 image according to the specified settings.

Used in init and draw functions: vg_lite_init_grad, vg_lite_set_grad, vg_lite_update_grad, vg_lite_get_grad_matrix, vg_lite_clear_grad, vg_lite_draw_grad.

vg_lite_linear_gradient_t constants

Type

Description

VLC_MAX_GRADIENT_STOPS

vg_lite_int32_t

Constant. Maximum number of gradient colors = 16.

vg_lite_linear_gradient_t members

colors [VLC_MAX_GRADIENT_STOPS]

vg_lite_uint32_t

Color array for the gradient

count

vg_lite_uint32_t

Number of colors

stops [VLC_MAX_GRADIENT_STOPS]

vg_lite_uint32_t

Number of color stops, from 0 to 255

matrix

vg_lite_matrix_t

Struct for the matrix to transform the gradient color ramp

image

vg_lite_buffer_t

Image object struct to represent the color ramp

Parent topic:Draw and gradient structures

vg_lite_ext_linear_gradient structure

This structure defines the organization of the extended parameters possible for a linear gradient (from April 2022).

Used in functions: vg_lite_draw_linear_grad.

vg_lite_ext_linear_gradient_t members

Type

Description

count

vg_lite_uint32_t

Count of colors, up to 256.

matrix

vg_lite_matrix_t

The matrix to transform the gradient.

image

vg_lite_buffer_t

The image for rendering as gradient pattern.

linear_grad

vg_lite_linear_gradient_parameter_t

Linear gradient parameters. Includes center point, focal point and radius.

ramp_length

vg_lite_uint32_t

Color ramp length for gradient paints provided to the driver.

color_ramp[VLC_MAX_COLOR_RAMP_STOPS]

vg_lite_color_ramp_t

Color ramp parameter for gradient paints provided to the driver.

converted_length

vg_lite_uint32_t

Converted internal color ramp length.

converted_ramp[VLC_MAX_COLOR_RAMP_STOPS+2]

vg_lite_color_ramp_t

Converted internal color ramp.

pre-multiplied

vg_lite_uint8_t

If this value is set to 1, the color value of color_ramp will be multiplied by the alpha value of color_ramp.

spread_mode

vg_lite_radial_gradient_spreadmode_t

The spread mode that is applied to the pixels out of the image after transformed.

|

Parent topic:Draw and gradient structures

vg_lite_linear_gradient_parameter structure

This structure defines a radial direction for a linear gradient. (from April 2022)

Line0 connects point (X0, Y0) to point (X1, Y1) and represents the radial direction of the linear gradient.

Line1 is a line perpendicular to line0 which passes through point (X0, Y0).

Line2 is a line perpendicular to line0 which passes through point (X1, Y1)

The linear gradient paint is applied at the intersection of the path fill area and the plane starting from line 1 and ending at line 2.

Used in structure: vg_lite_ext_linear_gradient.

Used in functions: vg_lite_set_linear_grad.

vg_lite_linear_gradient_parameter_t members

Type

Description

X0

vg_lite_float_t

X origin of linear gradient radial direction.

Y0

vg_lite_float_t

Y origin of linear gradient radial direction.

X1

vg_lite_float_t

X end point of linear gradient radial direction.

Y1

vg_lite_float_t

Y end point of linear gradient radial direction.

Parent topic:Draw and gradient structures

vg_lite_matrix_t structure

This structure is defined under the “Matrix control structures” section (see vg_lite_matrix_t structure).

Parent topic:Draw and gradient structures

vg_lite_path_t structure

This structure is defined under the “Vector path structures” section (see vg_lite_path_t structure).

Parent topic:Draw and gradient structures

vg_lite_radial_gradient_parameter_t structure

This structure defines the gradient radius and the X and Y coordinates for the center and focal points of the gradient (from November 2020, requires GC355 or GC555 hardware).

Used in radial gradient structure: vg_lite_radial_gradient_t.

vg_lite_radial_gradient_parameter_t member

Type

Description

cx

vg_lite_float_t

cy

vg_lite_float_t

r

vg_lite_float_t

fx

vg_lite_float_t

fy

vg_lite_float_t

Parent topic:Draw and gradient structures

vg_lite_radial_gradient_t structure

This structure defines the application of the radial gradient to fill a path. (from November 2020, requires GC355 or GC555 hardware).

Used in radial gradient functions: vg_lite_draw_grad, vg_lite_set_radial_grad, vg_lite_update_radial_grad, vg_lite_get_radial_grad, vg_lite_clear_radial_grad.

vg_lite_radial_gradient_t member

Type

Description

count

vg_lite_uint32_t

Count of colors, up to 256

matrix

vg_lite_matrix_t

Structure that specifies the transform matrix for the gradient

image

vg_lite_buffer_t

Structure that specifies the image for rendering as a gradient pattern

radial_grad

vg_lite_radial_gradient_parameter_t

Structure that specifies the location of the gradient’s center point (cx, cy), focal point(fx, fy) and radius(r)

ramp_length

vg_lite_uint32_t

Color ramp parameters for gradient paints provided to the driver

color_ramp[VLC_MAX_COLOR_RAMP_STOPS]

vg_lite_color_ramp_t

Structure that specifies the color ramp

converted_length

vg_lite_uint32_t

Converted internal color ramp.

converted_ramp[VLC_MAX_COLOR_RAMP_STOPS+2]

vg_lite_color_ramp_t

Structure that specifies the internal color ramp

pre_multiplied

vg_lite_uint32_t

If this value is set to 1, the color value of color_ramp will be multiplied by the alpha value of color_ramp.

spread_mode

vg_lite_radial_gradient_spreadmode_t

Enum that specifies the tiling mode, which is applied to the pixels out of the image after transformation

Parent topic:Draw and gradient structures

Parent topic:Vector-dased draw operations