Vector path functions

When using a small tessellation window and depending on a path’s size, a path might be uploaded to the hardware multiple times because the hardware scanline convert path with the provided tessellation window size, so VGLite path rendering performance might go down. That is why it is preferable to set the tessellation buffer size to the most common path size, for example if you only render 24-pt fonts, you can set the tessellation buffer to be 24x24.

All the RGBA color formats available in the vg_lite_buffer_format_t are supported as the destination buffer for the draw function.

vg_lite_get_path_length function

Description:

This function calculates the path command buffer length (in bytes).

The application is responsible for allocating a buffer according to the buffer length calculated with this function. Then, the buffer is used by the path as a command buffer. The VGLite driver does not allocate the path command buffer.

Syntax:

vg_lite_uint32_t vg_lite_get_path_length (
    vg_lite_uint8_t             *opcode,
    vg_lite_uint32_t            count,
    vg_lite_format_t            format
);

Parameters:

Parameter

Description

*opcode

Pointer to the opcode array to use to construct the path. (*opcode from March 2023)

count

The opcode count

format

The coordinate data format. All formats available in the vg_lite_format_t enum are valid formats for this function.

Returns:

Returns the command buffer length in bytes.

Parent topic:Vector path functions

vg_lite_append_path function

Description:

This function assembles the command buffer for the path. The command buffer is allocated by the application and assigned to the path. This function makes the final GPU command buffer for the path based on the input opcodes (cmd) and coordinates (data). The application is responsible for allocating a buffer large enough for the path*. (from Jan 2022, returns a vg_lite_error_t status code)*

Syntax:

vg_lite_error_t vg_lite_append_path (
    vg_lite_path_t              *path
    vg_lite_uint8_t             *opcode,
    vg_lite_pointer             data,
    vg_lite_uint32_t            seg_count
);

Parameters:

Parameter

Description

*path

Pointer to the vg_lite_path_t structure with the path definition.

*opcode

Pointer to the opcode array to use to construct the path. (*opcode from March 2023)

data

Pointer to the coordinate data array to use to construct the path

seg_count

The opcode count

Returns:

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

Parent topic:Vector path functions

vg_lite_init_path function

Description:

This function initializes a path definition with specified values. (From Dec 2019 returns vg_lite_error_t, previous was void.)

Syntax:

vg_lite_error_t vg_lite_init_path (
    vg_lite_path_t              *path,
    vg_lite_format_t            format,
    vg_lite_quality_t           quality,
    vg_lite_uint32_t            length,
    vg_lite_pointer             *data,
    vg_lite_float_t             min_x, 
    vg_lite_float_t             min_y,
    vg_lite_float_t             max_x, 
    vg_lite_float_t             max_y
);

Parameters:

Parameter

Description

*path

Pointer to the vg_lite_path_t structure for the path object to be initialized with the member values specified.

format

The coordinate data format. All formats available in the vg_lite_format_t enum are valid formats for this function.

quality

The quality for the path object. All formats available in the vg_lite_quality_t enum are valid formats for this function.

length

The length of the path data (in bytes)

*data

Pointer to path data

min_x min_y max_x max_y

Minimum and maximum x and y values specifying the bounding box of the path

Returns:

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

Parent topic:Vector path functions

vg_lite_init_arc_path function

Description:

This function initializes an arc path definition with specified values. (from February 2021)

Syntax:

vg_lite_error_t vg_lite_init_arc_path (
    vg_lite_path_t              *path,
    vg_lite_format_t            format,
    vg_lite_quality_t           quality,
    vg_lite_uint32_t            length,
    vg_lite_pointer             *data,
    vg_lite_float_t             min_x, 
    vg_lite_float_t             min_y,
    vg_lite_float_t             max_x, 
    vg_lite_float_t             max_y
);

Parameters:

Parameter

Function

*path

Pointer to the vg_lite_path_t structure for the path object to be initialized with the member values specified.

format

The coordinate data format. The vg_lite_format_t enum value should be FP32.

quality

The quality for the path object. All formats available in the vg_lite_quality_t enum are valid formats for this function.

length

The length of the path data (in bytes).

*data

Pointer to path data.

min_x min_y max_x max_y

Minimum and maximum x and y values specifying the bounding box of the path.

Returns:

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

Parent topic:Vector path functions

vg_lite_upload_path function

Description:

This function is used to upload a path to GPU memory.

In normal cases, the VGLite driver will copy any path data into a command buffer structure during runtime. This does take some time if there are many paths to be rendered. Also, in an embedded system the path data won’t change - so it makes sense to upload the path data into GPU memory in such a form that the GPU can directly access it. This function will signal the driver to allocate a buffer that will contain the path data and the required command buffer header and footer data for the GPU to access the data directly. Call vg_lite_clear_path to free this buffer after the path is used.

Syntax:

vg_lite_error_t vg_lite_upload_path (
    vg_lite_path_t              *path
);

Parameters:

Parameter

Description

*path

Pointer to a vg_lite_path_t structure that contains the path to be uploaded.

Returns:

VG_LITE_OUT_OF_MEMORY if not enough GPU memory is available for buffer allocation.

Parent topic:Vector path functions

vg_lite_clear_path function

Description:

This function will clear and reset path member values. If the path has been uploaded, it frees the GPU memory allocated when uploading the path. (From Dec 2019 returns vg_lite_error_t, previous was void.)

.

Syntax:

vg_lite_error_t vg_lite_clear_path (
    vg_lite_path_t              *path
);

Parameters:

Parameter

Description

*path

Pointer to the vg_lite_path_t path definition to be cleared.

Returns:

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

Parent topic:Vector path functions

Parent topic:Vector path control