Matrices

This part of the API provides matrix controls.

Note: All the transformations in the driver/API are actually the final plane/surface coordinate system. There is no transformation of different coordinate systems with VGLite.

Matrix control float parameter type

Name

Typedef

Value

vg_lite_float_t

float

A single-precision floating-point number

vg_lite_pixel_matrix_t [20]

vg_lite_float_t

Parent topic:Matrices

Matrix control structures

This section provides an overview of the graphic transformation matrix control structures.

vg_lite_matrix_t structure

This structure defines a 3x3 floating point matrix.

Used in structures: vg_lite_linear_gradient_t, vg_lite_radial_gradient_t.

Used in blit functions: vg_lite_blit, vg_lite_blit_rect.

Used in draw functions: vg_lite_draw, vg_lite_draw_gradient, vg_lite_draw_radial_gradient, vg_lite_draw_pattern, vg_lite_identity, vg_lite_scale, vg_lite_translate.

vg_lite_matrix_t member

Type

Description

m[3][3]

vg_lite_float_t

3x3 matrix, in [row] [column] order

Parent topic:Matrix control structures

vg_lite_pixel_channel_enable_t structure

This structure provides enable disable flags for hardware pixel channels A,R,G,B.

Used in function: vg_lite_set_pixel_matrix_t.

vg_lite_pixel_channel_enable_t members

Type

Description

enable_a

vg_lite_uint8_t

Enable A channel

enable_b

vg_lite_uint8_t

Enable B channel

enable_g

vg_lite_uint8_t

Enable G channel

enable_r

vg_lite_uint8_t

Enable R channel

Parent topic:Matrix control structures

Parent topic:Matrices

Matrix control functions

This section provides an overview of the matrix control functions.

vg_lite_identity function

Description:

This function loads an identity matrix into a matrix variable.

Syntax:

vg_lite_error_t vg_lite_identity (
    vg_lite_matrix_t            *matrix,
);

Parameters:

Name

Description

*matrix

Pointer to the vg_lite_matrix_t structure that will be loaded with an identity matrix.

Returns:

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

Parent topic:Matrix control functions

vg_lite_set_pixel_matrix function

Description:

This function sets up a pixel transform matrix m[20] which transforms each pixel as follows:

The pixel transform for the A, R, G, B channels can be enabled/disabled individually with the channel parameter.

Applications can use VGLite API vg_lite_query_feature (gcFEATURE_BIT_VG_PIXEL_MATRIX) to determine HW support for gaussian blur.

Syntax:

vg_lite_error_t vg_lite_set_pixel_matrix (
    vg_lite_pixel_matrix_t           matrix,
    vg_lite_pixel_channel_enable_t   *channel
);

Parameters:

Name

Description

*matrix

Specifies the vg_lite_pixel_matrix_t pixel transform matrix that will be loaded.

*channel

Pointer to the vg_lite_pixel_channel_enable_t structure used to enable/disable individual channels.

Returns:

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

Parent topic:Matrix control functions

vg_lite_rotate function

Description:

This function rotates a matrix a specified number of degrees.

Syntax:

vg_lite_error_t vg_lite_rotate (
    vg_lite_float_t             degrees,
    vg_lite_matrix_t            *matrix
);

Parameters:

Name

Description

degrees

Number of degrees to rotate the matrix. Positive numbers rotate clockwise.The coordinates for the transformation are given in the surface coordinate system (top-to-bottom orientation). Rotations with positive angles are in the clockwise direction.

*matrix

Pointer to the vg_lite_matrix_t structure that has to be rotated

Returns:

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

Parent topic:Matrix control functions

vg_lite_scale function

Description:

This function scales a matrix in both horizontal and vertical directions.

Syntax:

vg_lite_error_t vg_lite_scale (
    vg_lite_float_t             scale_x,
    vg_lite_float_t             scale_y,
    vg_lite_matrix_t            *matrix
);

Parameters:

Name

Description

scale_x

Horizontal scale

scale_y

Vertical scale

matrix

Pointer to the vg_lite_matrix_t structure that will be scaled.

Returns:

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

Parent topic:Matrix control functions

vg_lite_translate function

Description:

This function translates a matrix to a new location.

Syntax:

vg_lite_error_t vg_lite_translate (
    vg_lite_float_t             x,
    vg_lite_float_t             y,
    vg_lite_matrix_t            *matrix
);

Parameters:

Name

Description

x

X location of the transformation.

y

Y location of the transformation.

matrix

Pointer to the vg_lite_matrix_t structure that will be translated.

Returns:

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

Parent topic:Matrix control functions

Parent topic:Matrices