Stroke operations

This part of the API performs stroke operations. (from March 2022)

Stroke enumerations

This section gives details on stroke enumerations.

vg_lite_cap_style_t enumeration

Defines the style of cap at the end of a stroke (from March 2022).

Used in structure: vg_lite_stroke_t.

Used in function: vg_lite_set_stroke.

vg_lite_cap_style_t values

Description

VG_LITE_CAP_BUTT

The butt end cap style terminates each segment with a line perpendicular to the tangent at each endpoint.

VG_LITE_CAP_ROUND

The round end cap style appends a semicircle with a diameter equal to the line width centered around each endpoint.

VG_LITE_CAP_SQUARE

The square end cap style appends a rectangle with two sides of length equal to the line width perpendicular to the tangent, and two sides of length equal to half the line width parallel to the tangent, at each endpoint.

Parent topic:Stroke enumerations

vg_lite_path_type_t enumeration

Defines the type of draw path (from March 2022).

Used in structure: vg_lite_path_t, vg_lite_stroke_t.

Used in function: vg_lite_set_path_type.

vg_lite_path_type_t string values

Description

VG_LITE_DRAW_FILL_PATH

Draw path is fill.

VG_LITE_DRAW_STROKE_PATH

Draw path is stroke.

VG_LITE_DRAW_FILL_STROKE_PATH

Draw path is both fill and stroke.

Parent topic:Stroke enumerations

vg_lite_join_style_t enumeration

Defines the type of styles available for line joints. (from March 2022)

Used in structure: vg_lite_stroke_t.

Used in function: vg_lite_set_stroke.

vg_lite_join_style_t string values

Description

VG_LITE_JOIN_MITER

The miter join style appends a trapezoid with one vertex at the intersection point of the two original lines, two adjacent vertices at the outer endpoints of the two “thickened” lines and a fourth vertex at the extrapolated intersection point of the outer perimeters of the two “thickened” lines.

VG_LITE_JOIN_ROUND

The round join style appends a wedge-shaped portion of a circle, centered at the intersection point of the two original lines, having a radius equal to half the line width.

VG_LITE_JOIN_BEVEL

The bevel type join style appends a triangle with two vertices at the outer endpoints of the two “thickened” lines and a third vertex at the intersection point of the two original lines.

Parent topic:Stroke enumerations

Parent topic:Stroke operations

Stroke structures

This section gives details on stroke structures.

vg_lite_path_t structure

Defined under Vector Path Structures - vg_lite_path_t structure.

(additional members added for stroke from March 2022)

Parent topic:Stroke structures

vg_lite_path_list_t structure

The structure vg_lite_path_list_ptr points to the vg_lite_path_list structure that provides divided path data according to MOVE/MOVE_REL. (from Aug 2023)

Used (vg_lite_path_list_ptr) in structures: vg_lite_stroke_t.

vg_lite_path_list_t members

Type

Description

path_points

vg_lite_path_point_ptr

path_end

vg_lite_path_point_ptr

point_count

vg_lite_uint32_t

next

vg_lite_path_list_ptr

closed

vg_lite_uint8_t

Parent topic:Stroke structures

vg_lite_path_point_t structure

The structure vg_lite_path_point_ptr points to the vg_lite_path_point structure which provides path detail (from March 2022)

Used (vg_lite_path_point_ptr) in structures: vg_lite_path_point_t, vg_lite_stroke_conversion. vg_lite_sub_path_t.

vg_lite_path_point_t members

Type

Description

x

vg_lite_float_t

X coordinate

y

vg_lite_float_t

Y coordinate

flatten_flag

vg_lite_uint8_t

Flatten flag for flattened path

curve_type

vg_lite_uint8_t

Curve type for the stroke path

tangentX

vg_lite_float_t

X tangent (Note: #define centerX tangent)

tangentY

vg_lite_float_t

Y tangent (Note: #define centerX tangent)

length

vg_lite_float_t

Line length

prev

vg_lite_path_point_ptr

Pointer to the previous point node

Parent topic:Stroke structures

vg_lite_stroke_t structure

The structure provides stroke parameters and pointers to temp storage for a stroke sub path. Refer to the function vg_lite_set_stroke parameter descriptions for additional description for some members. (from March 2022)

Used in structure: vg_lite_path_t.

vg_lite_stroke_t members

Type

Description

cap_style

vg_lite_cap_style_t

Stroke cap style

join_style

vg_lite_join_style_t

Stroke joint style

line_width

vg_lite_float_t

Stroke line width

miter_limit

vg_lite_float_t

Stroke miter limit

*dash_pattern

vg_lite_float_t

Pointer to stroke dash pattern

pattern_count

vg_lite_uint32_t

Number of dash pattern repetitions

dash_phase

vg_lite_float_t

Stroke dash phrase

dash_length

vg_lite_float_t

Stroke dash initial length

dash_index

vg_lite_uint32_t

Stroke dash initial index

half_width

vg_lite_float_t

Half line width

pattern_length

vg_lite_float_t

Total length of stroke dash patterns.

miter_square

vg_lite_float_t

For fast checking

path_points

vg_lite_path_point_ptr

Temp storage for stroke sub path

path_end

vg_lite_path_point_ptr

Temp storage for stroke sub path

point_count

unint32_t

Temp storage for stroke sub path

left_point

vg_lite_path_point_ptr

Temp storage for stroke sub path

right_pont

vg_lite_path_point_ptr

Temp storage for stroke sub path

stroke_points

vg_lite_path_point_ptr

Temp storage for stroke sub path

stroke_end

vg_lite_path_point_ptr

Temp storage for stroke sub path

stroke_count

vg_lite_uint32_t

Temp storage for stroke sub path

path_list_divide

vg_lite_path_list_ptr

Divide stroke path according to move or move_rel for avoiding implicit closure. (from Aug 2023)

cur_list

vg_lite_path_list_ptr

Pointer to current divided path data. (from Aug 2023)

add_end

vg_lite_uint8_t

Flag that adds end_path in driver (from Aug 2023)

dash_reset

vg_lite_uint8_t

(from Aug 2023)

stroke_paths

vg_lite_sub_path_ptr

last_stroke

vg_lite_sub_path_ptr

swing_handling

vg_lite_uint32_t

swing_deltax

vg_lite_float_t

swing_deltay

vg_lite_float_t

swing_start

vg_lite_path_point_ptr

swing_stroke

vg_lite_path_point_ptr

swing_length

vg_lite_float_t

swing_centlen

vg_lite_float_t

swing_count

vg_lite_uint32_t

need_swing

vg_lite_uint8_t

swing_ccw

vg_lite_uint8_t

stroke_length

vg_lite_float_t

stroke_size

vg_lite_uint32_t

fattened

vg_lite_uint8_t

The stroke line is a fat line.

closed

vg_lite_uint8_t

Parent topic:Stroke structures

vg_lite_sub_path_t structure

The structure vg_lite_sub_path_ptr points to the vg_lite_sub_path structure that provides sub path detail and a pointer to the next sub path. (from March 2022)

Used in structure: vg_lite_stroke_conversion.

vg_lite_path_point_t members

Type

Description

next

vg_lite_sub_path_ptr

Pointer to the next sub path

point_count

vg_lite_uint32_t

Number of points in the sub path

point_list

vg_lite_path_point_ptr

Pointer to the point list.

end_point

vg_lite_path_point_ptr

Pointer to the last point.

closed

vg_lite_uint8_t

Indicates whether or not the path is closed.

length

vg_lite_float_t

Length of the sub path.

Parent topic:Stroke structures

Parent topic:Stroke operations

Stroke functions

All return vg_lite_error_t status.

vg_lite_set_path_type function

Description:

This function sets the path type*. (from March 2022)*

Syntax:

vg_lite_error_t vg_lite_set_path_type (
    vg_lite_path_t              *path,
    vg_lite_path_type_t         path_type
);  

Parameters:

Parameter

Description

*path

Pointer to the vg_lite_path_t structure that describes the vector path.

path_type

Pointer to a vg_lite_path_type_t structure that describes the path type.

Returns:

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

Parent topic:Stroke functions

vg_lite_set_stroke function

Description:

This function uses input parameters to set stroke attributes (from March 2022).

Syntax:

vg_lite_error_t vg_lite_set_stroke (
    vg_lite_path_t              *path,
    vg_lite_cap_style_t         cap_style,
    vg_lite_join_style_t        join_style,
    vg_lite_float_t             line_width,
    vg_lite_float_t             miter_limit,
    vg_lite_float_t             *dash_pattern,
    vg_lite_uint32_t            pattern_count,
    vg_lite_float_t             dash_phase,
    vg_lite_color_t             color
);  

Parameters:

Parameter

Description

*path

Pointer to the vg_lite_path_t structure that describes the path.

cap_style

The end cap style is defined by the vg_lite_cap_style_t enum.

join_style

The line join style defined by the vg_lite_join_style_t enum.

line_width

The line width of the stroke path. A line width less than or equal to 0 prevents stroking from taking place.

miter_limit

When stroking using the Miter stroke vg_lite_join_style_t, the miter length (that is, the length between the intersection points of the inner and outer perimeters of the two “fattened” lines) is compared to the product of the user-set miter limit and the line width. If the miter length exceeds this product, the Miter join is not drawn and a Bevel join is substituted. Note: Miter limit values less than 1 are silently clamped to 1.

*dash_pattern

Pointer to a dash pattern that consists of a sequence of lengths of alternating “on” and “off” dash segments. The first value of the dash array defines the length, in user coordinates, of the first “on” dash segment. The second value defines the length of the following “off” segment. Each subsequent pair of values defines one “on” and one “off” segment. Note: If the dash pattern has an odd number of elements, the final element is ignored.

pattern_count

The count of dash on/off segments.

dash_phase

Defines the starting point in the dash pattern that is associated with the start of the first segment of the path. For example, if the dash pattern is [10 20 30 40] and the dash phase is 35, the path is stroked with an “on” segment of length 25 (skipping the first “on” segment of length 10, the following “off” segment of length 20, and the first 5 units of the next “on” segment), followed by an “off” segment of length 40. The pattern is then repeated from the beginning, with an “on” segment of length 10, an “off” segment of length 20, an “on” segment of length 30.

color

The stroke color.

Returns:

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

Parent topic:Stroke functions

vg_lite_update_stroke function

Description:

This function uses the path and stroke attributes as specified with the function vg_lite_set_stroke to update the stroke path’s parameters and generate stroke path data . (from March 2022)

Syntax:

vg_lite_error_t vg_lite_update_stroke (
    vg_lite_path_t              *path,
);  

Parameters:

Parameter

Description

*path

Pointer to the vg_lite_path_t structure that describes the path.

Returns:

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

Parent topic:Stroke functions

Parent topic:Stroke operations