ThorVG
v0.6
|
A module for managing two-dimensional figures and their properties. More...
Enumerations | |
enum | Tvg_Path_Command { TVG_PATH_COMMAND_CLOSE = 0, TVG_PATH_COMMAND_MOVE_TO, TVG_PATH_COMMAND_LINE_TO, TVG_PATH_COMMAND_CUBIC_TO } |
Enumeration specifying the values of the path commands accepted by TVG. More... | |
enum | Tvg_Stroke_Cap { TVG_STROKE_CAP_SQUARE = 0, TVG_STROKE_CAP_ROUND, TVG_STROKE_CAP_BUTT } |
Enumeration determining the ending type of a stroke in the open sub-paths. More... | |
enum | Tvg_Stroke_Join { TVG_STROKE_JOIN_BEVEL = 0, TVG_STROKE_JOIN_ROUND, TVG_STROKE_JOIN_MITER } |
Enumeration specifying how to fill the area outside the gradient bounds. More... | |
enum | Tvg_Stroke_Fill { TVG_STROKE_FILL_PAD = 0, TVG_STROKE_FILL_REFLECT, TVG_STROKE_FILL_REPEAT } |
Enumeration specifying how to fill the area outside the gradient bounds. More... | |
enum | Tvg_Fill_Rule { TVG_FILL_RULE_WINDING = 0, TVG_FILL_RULE_EVEN_ODD } |
Enumeration specifying the algorithm used to establish which parts of the shape are treated as the inside of the shape. More... | |
Functions | |
TVG_EXPORT Tvg_Paint * | tvg_shape_new () |
Creates a new shape object. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_reset (Tvg_Paint *paint) |
Resets the shape path properties. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_move_to (Tvg_Paint *paint, float x, float y) |
Sets the initial point of the sub-path. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_line_to (Tvg_Paint *paint, float x, float y) |
Adds a new point to the sub-path, which results in drawing a line from the current point to the given end-point. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_cubic_to (Tvg_Paint *paint, float cx1, float cy1, float cx2, float cy2, float x, float y) |
Adds new points to the sub-path, which results in drawing a cubic Bezier curve. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_close (Tvg_Paint *paint) |
Closes the current sub-path by drawing a line from the current point to the initial point of the sub-path. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_append_rect (Tvg_Paint *paint, float x, float y, float w, float h, float rx, float ry) |
Appends a rectangle to the path. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_append_circle (Tvg_Paint *paint, float cx, float cy, float rx, float ry) |
Appends an ellipse to the path. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_append_arc (Tvg_Paint *paint, float cx, float cy, float radius, float startAngle, float sweep, uint8_t pie) |
Appends a circular arc to the path. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_append_path (Tvg_Paint *paint, const Tvg_Path_Command *cmds, uint32_t cmdCnt, const Tvg_Point *pts, uint32_t ptsCnt) |
Appends a given sub-path to the path. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_get_path_coords (const Tvg_Paint *paint, const Tvg_Point **pts, uint32_t *cnt) |
Gets the points values of the path. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_get_path_commands (const Tvg_Paint *paint, const Tvg_Path_Command **cmds, uint32_t *cnt) |
Gets the commands data of the path. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_set_stroke_width (Tvg_Paint *paint, float width) |
Sets the stroke width for all of the figures from the paint . More... | |
TVG_EXPORT Tvg_Result | tvg_shape_get_stroke_width (const Tvg_Paint *paint, float *width) |
Gets the shape's stroke width. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_set_stroke_color (Tvg_Paint *paint, uint8_t r, uint8_t g, uint8_t b, uint8_t a) |
Sets the shape's stroke color. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_get_stroke_color (const Tvg_Paint *paint, uint8_t *r, uint8_t *g, uint8_t *b, uint8_t *a) |
Gets the shape's stroke color. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_set_stroke_linear_gradient (Tvg_Paint *paint, Tvg_Gradient *grad) |
Sets the linear gradient fill of the stroke for all of the figures from the path. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_set_stroke_radial_gradient (Tvg_Paint *paint, Tvg_Gradient *grad) |
Sets the radial gradient fill of the stroke for all of the figures from the path. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_get_stroke_gradient (const Tvg_Paint *paint, Tvg_Gradient **grad) |
Gets the gradient fill of the shape's stroke. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_set_stroke_dash (Tvg_Paint *paint, const float *dashPattern, uint32_t cnt) |
Sets the shape's stroke dash pattern. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_get_stroke_dash (const Tvg_Paint *paint, const float **dashPattern, uint32_t *cnt) |
Gets the dash pattern of the stroke. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_set_stroke_cap (Tvg_Paint *paint, Tvg_Stroke_Cap cap) |
Sets the cap style used for stroking the path. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_get_stroke_cap (const Tvg_Paint *paint, Tvg_Stroke_Cap *cap) |
Gets the stroke cap style used for stroking the path. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_set_stroke_join (Tvg_Paint *paint, Tvg_Stroke_Join join) |
Sets the join style for stroked path segments. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_get_stroke_join (const Tvg_Paint *paint, Tvg_Stroke_Join *join) |
The function gets the stroke join method. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_set_fill_color (Tvg_Paint *paint, uint8_t r, uint8_t g, uint8_t b, uint8_t a) |
Sets the shape's solid color. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_get_fill_color (const Tvg_Paint *paint, uint8_t *r, uint8_t *g, uint8_t *b, uint8_t *a) |
Gets the shape's solid color. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_set_fill_rule (Tvg_Paint *paint, Tvg_Fill_Rule rule) |
Sets the shape's fill rule. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_get_fill_rule (const Tvg_Paint *paint, Tvg_Fill_Rule *rule) |
Gets the shape's fill rule. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_set_linear_gradient (Tvg_Paint *paint, Tvg_Gradient *grad) |
Sets the linear gradient fill for all of the figures from the path. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_set_radial_gradient (Tvg_Paint *paint, Tvg_Gradient *grad) |
Sets the radial gradient fill for all of the figures from the path. More... | |
TVG_EXPORT Tvg_Result | tvg_shape_get_gradient (const Tvg_Paint *paint, Tvg_Gradient **grad) |
Gets the gradient fill of the shape. More... | |
A module for managing two-dimensional figures and their properties.
A shape has three major properties: shape outline, stroking, filling. The outline in the shape is retained as the path. Path can be composed by accumulating primitive commands such as tvg_shape_move_to(), tvg_shape_line_to(), tvg_shape_cubic_to() or complete shape interfaces such as tvg_shape_append_rect(), tvg_shape_append_circle(), etc. Path can consists of sub-paths. One sub-path is determined by a close command.
The stroke of a shape is an optional property in case the shape needs to be represented with/without the outline borders. It's efficient since the shape path and the stroking path can be shared with each other. It's also convenient when controlling both in one context.
enum Tvg_Fill_Rule |
Enumeration specifying the algorithm used to establish which parts of the shape are treated as the inside of the shape.
enum Tvg_Path_Command |
Enumeration specifying the values of the path commands accepted by TVG.
Not to be confused with the path commands from the svg path element (like M, L, Q, H and many others). TVG interprets all of them and translates to the ones from the PathCommand values.
enum Tvg_Stroke_Cap |
Enumeration determining the ending type of a stroke in the open sub-paths.
enum Tvg_Stroke_Fill |
Enumeration specifying how to fill the area outside the gradient bounds.
enum Tvg_Stroke_Join |
Enumeration specifying how to fill the area outside the gradient bounds.
TVG_EXPORT Tvg_Result tvg_shape_append_arc | ( | Tvg_Paint * | paint, |
float | cx, | ||
float | cy, | ||
float | radius, | ||
float | startAngle, | ||
float | sweep, | ||
uint8_t | pie | ||
) |
Appends a circular arc to the path.
The arc is treated as a new sub-path - it is not connected with the previous sub-path. The current point value is set to the end-point of the arc in case pie
is false
, and to the center of the arc otherwise.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[in] | cx | The horizontal coordinate of the center of the arc. |
[in] | cy | The vertical coordinate of the center of the arc. |
[in] | radius | The radius of the arc. |
[in] | startAngle | The start angle of the arc given in degrees, measured counter-clockwise from the horizontal line. |
[in] | sweep | The central angle of the arc given in degrees, measured counter-clockwise from startAngle . |
[in] | pie | Specifies whether to draw radii from the arc's center to both of its end-point - drawn if true . |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid Tvg_Paint pointer. |
sweep
value greater than 360 degrees, is equivalent to calling tvg_shape_append_circle(paint, cx, cy, radius, radius). TVG_EXPORT Tvg_Result tvg_shape_append_circle | ( | Tvg_Paint * | paint, |
float | cx, | ||
float | cy, | ||
float | rx, | ||
float | ry | ||
) |
Appends an ellipse to the path.
The position of the ellipse is specified by the coordinates of its center - cx
and cy
arguments.
The ellipse is treated as a new sub-path - it is not connected with the previous sub-path.
The value of the current point is set to (cx
, cy
- ry
).
[in] | paint | A Tvg_Paint pointer to the shape object. |
[in] | cx | The horizontal coordinate of the center of the ellipse. |
[in] | cy | The vertical coordinate of the center of the ellipse. |
[in] | rx | The x-axis radius of the ellipse. |
[in] | ry | The y-axis radius of the ellipse. |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid Tvg_Paint pointer. |
TVG_EXPORT Tvg_Result tvg_shape_append_path | ( | Tvg_Paint * | paint, |
const Tvg_Path_Command * | cmds, | ||
uint32_t | cmdCnt, | ||
const Tvg_Point * | pts, | ||
uint32_t | ptsCnt | ||
) |
Appends a given sub-path to the path.
The current point value is set to the last point from the sub-path. For each command from the cmds
array, an appropriate number of points in pts
array should be specified. If the number of points in the pts
array is different than the number required by the cmds
array, the shape with this sub-path will not be displayed on the screen.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[in] | cmds | The array of the commands in the sub-path. |
[in] | cmdCnt | The length of the cmds array. |
[in] | pts | The array of the two-dimensional points. |
[in] | ptsCnt | The length of the pts array. |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | A nullptr passed as the argument or cmdCnt or ptsCnt equal to zero. |
TVG_EXPORT Tvg_Result tvg_shape_append_rect | ( | Tvg_Paint * | paint, |
float | x, | ||
float | y, | ||
float | w, | ||
float | h, | ||
float | rx, | ||
float | ry | ||
) |
Appends a rectangle to the path.
The rectangle with rounded corners can be achieved by setting non-zero values to rx
and ry
arguments. The rx
and ry
values specify the radii of the ellipse defining the rounding of the corners.
The position of the rectangle is specified by the coordinates of its upper left corner - x
and y
arguments.
The rectangle is treated as a new sub-path - it is not connected with the previous sub-path.
The value of the current point is set to (x
+ rx
, y
) - in case rx
is greater than w/2
the current point is set to (x
+ w/2
, y
)
[in] | paint | A Tvg_Paint pointer to the shape object. |
[in] | x | The horizontal coordinate of the upper left corner of the rectangle. |
[in] | y | The vertical coordinate of the upper left corner of the rectangle. |
[in] | w | The width of the rectangle. |
[in] | h | The height of the rectangle. |
[in] | rx | The x-axis radius of the ellipse defining the rounded corners of the rectangle. |
[in] | ry | The y-axis radius of the ellipse defining the rounded corners of the rectangle. |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid Tvg_Paint pointer. |
&
rx
and ry
greater than or equal to the half of w
and the half of h
, respectively, the shape become an ellipse. TVG_EXPORT Tvg_Result tvg_shape_close | ( | Tvg_Paint * | paint | ) |
Closes the current sub-path by drawing a line from the current point to the initial point of the sub-path.
The value of the current point is set to the initial point of the closed sub-path.
[in] | paint | A Tvg_Paint pointer to the shape object. |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid Tvg_Paint pointer. |
TVG_EXPORT Tvg_Result tvg_shape_cubic_to | ( | Tvg_Paint * | paint, |
float | cx1, | ||
float | cy1, | ||
float | cx2, | ||
float | cy2, | ||
float | x, | ||
float | y | ||
) |
Adds new points to the sub-path, which results in drawing a cubic Bezier curve.
The Bezier curve starts at the current point and ends at the given end-point (x
, y
). Two control points (cx1
, cy1
) and (cx2
, cy2
) are used to determine the shape of the curve. The value of the current point is set to the given end-point.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[in] | cx1 | The horizontal coordinate of the 1st control point. |
[in] | cy1 | The vertical coordinate of the 1st control point. |
[in] | cx2 | The horizontal coordinate of the 2nd control point. |
[in] | cy2 | The vertical coordinate of the 2nd control point. |
[in] | x | The horizontal coordinate of the endpoint of the curve. |
[in] | y | The vertical coordinate of the endpoint of the curve. |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid Tvg_Paint pointer. |
TVG_EXPORT Tvg_Result tvg_shape_get_fill_color | ( | const Tvg_Paint * | paint, |
uint8_t * | r, | ||
uint8_t * | g, | ||
uint8_t * | b, | ||
uint8_t * | a | ||
) |
Gets the shape's solid color.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[out] | r | The red color channel value in the range [0 ~ 255]. The default value is 0. |
[out] | g | The green color channel value in the range [0 ~ 255]. The default value is 0. |
[out] | b | The blue color channel value in the range [0 ~ 255]. The default value is 0. |
[out] | a | The alpha channel value in the range [0 ~ 255], where 0 is completely transparent and 255 is opaque. The default value is 0. |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid Tvg_Paint pointer. |
TVG_EXPORT Tvg_Result tvg_shape_get_fill_rule | ( | const Tvg_Paint * | paint, |
Tvg_Fill_Rule * | rule | ||
) |
Gets the shape's fill rule.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[out] | rule | shape's fill rule |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid pointer passed as an argument. |
TVG_EXPORT Tvg_Result tvg_shape_get_gradient | ( | const Tvg_Paint * | paint, |
Tvg_Gradient ** | grad | ||
) |
Gets the gradient fill of the shape.
The function does not allocate any data.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[out] | grad | The gradient fill. |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid pointer passed as an argument. |
TVG_EXPORT Tvg_Result tvg_shape_get_path_commands | ( | const Tvg_Paint * | paint, |
const Tvg_Path_Command ** | cmds, | ||
uint32_t * | cnt | ||
) |
Gets the commands data of the path.
The function does not allocate any data. There is no need to free the cmds
array.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[out] | cmds | The pointer to the array of the commands from the path. |
[out] | cnt | The length of the cmds array. |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | A nullptr passed as the argument. |
TVG_EXPORT Tvg_Result tvg_shape_get_path_coords | ( | const Tvg_Paint * | paint, |
const Tvg_Point ** | pts, | ||
uint32_t * | cnt | ||
) |
Gets the points values of the path.
The function does not allocate any data, it operates on internal memory. There is no need to free the pts
array.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[out] | pts | The pointer to the array of the two-dimensional points from the path. |
[out] | cnt | The length of the pts array. |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | A nullptr passed as the argument. |
TVG_EXPORT Tvg_Result tvg_shape_get_stroke_cap | ( | const Tvg_Paint * | paint, |
Tvg_Stroke_Cap * | cap | ||
) |
Gets the stroke cap style used for stroking the path.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[out] | cap | The cap style value. |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid pointer passed as an argument. |
TVG_EXPORT Tvg_Result tvg_shape_get_stroke_color | ( | const Tvg_Paint * | paint, |
uint8_t * | r, | ||
uint8_t * | g, | ||
uint8_t * | b, | ||
uint8_t * | a | ||
) |
Gets the shape's stroke color.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[out] | r | The red color channel value in the range [0 ~ 255]. The default value is 0. |
[out] | g | The green color channel value in the range [0 ~ 255]. The default value is 0. |
[out] | b | The blue color channel value in the range [0 ~ 255]. The default value is 0. |
[out] | a | The alpha channel value in the range [0 ~ 255], where 0 is completely transparent and 255 is opaque. |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid Tvg_Paint pointer. |
TVG_RESULT_INSUFFICIENT_CONDITION | No stroke was set. |
TVG_EXPORT Tvg_Result tvg_shape_get_stroke_dash | ( | const Tvg_Paint * | paint, |
const float ** | dashPattern, | ||
uint32_t * | cnt | ||
) |
Gets the dash pattern of the stroke.
The function does not allocate any memory.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[out] | dashPattern | The array of consecutive pair values of the dash length and the gap length. |
[out] | cnt | The size of the dashPattern array. |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid pointer passed as an argument. |
TVG_EXPORT Tvg_Result tvg_shape_get_stroke_gradient | ( | const Tvg_Paint * | paint, |
Tvg_Gradient ** | grad | ||
) |
Gets the gradient fill of the shape's stroke.
The function does not allocate any memory.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[out] | grad | The gradient fill. |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid pointer passed as an argument. |
TVG_EXPORT Tvg_Result tvg_shape_get_stroke_join | ( | const Tvg_Paint * | paint, |
Tvg_Stroke_Join * | join | ||
) |
The function gets the stroke join method.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[out] | join | The join style value. |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid pointer passed as an argument. |
TVG_EXPORT Tvg_Result tvg_shape_get_stroke_width | ( | const Tvg_Paint * | paint, |
float * | width | ||
) |
Gets the shape's stroke width.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[out] | width | The stroke width. |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid pointer passed as an argument. |
TVG_EXPORT Tvg_Result tvg_shape_line_to | ( | Tvg_Paint * | paint, |
float | x, | ||
float | y | ||
) |
Adds a new point to the sub-path, which results in drawing a line from the current point to the given end-point.
The value of the current point is set to the given end-point.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[in] | x | The horizontal coordinate of the end-point of the line. |
[in] | y | The vertical coordinate of the end-point of the line. |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid Tvg_Paint pointer. |
TVG_EXPORT Tvg_Result tvg_shape_move_to | ( | Tvg_Paint * | paint, |
float | x, | ||
float | y | ||
) |
Sets the initial point of the sub-path.
The value of the current point is set to the given point.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[in] | x | The horizontal coordinate of the initial point of the sub-path. |
[in] | y | The vertical coordinate of the initial point of the sub-path. |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid Tvg_Paint pointer. |
TVG_EXPORT Tvg_Paint* tvg_shape_new | ( | ) |
Creates a new shape object.
TVG_EXPORT Tvg_Result tvg_shape_reset | ( | Tvg_Paint * | paint | ) |
Resets the shape path properties.
The color, the fill and the stroke properties are retained.
[in] | paint | A Tvg_Paint pointer to the shape object. |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid Tvg_Paint pointer. |
TVG_EXPORT Tvg_Result tvg_shape_set_fill_color | ( | Tvg_Paint * | paint, |
uint8_t | r, | ||
uint8_t | g, | ||
uint8_t | b, | ||
uint8_t | a | ||
) |
Sets the shape's solid color.
The parts of the shape defined as inner are colored.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[in] | r | The red color channel value in the range [0 ~ 255]. The default value is 0. |
[in] | g | The green color channel value in the range [0 ~ 255]. The default value is 0. |
[in] | b | The blue color channel value in the range [0 ~ 255]. The default value is 0. |
[in] | a | The alpha channel value in the range [0 ~ 255], where 0 is completely transparent and 255 is opaque. The default value is 0. |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid Tvg_Paint pointer. |
TVG_EXPORT Tvg_Result tvg_shape_set_fill_rule | ( | Tvg_Paint * | paint, |
Tvg_Fill_Rule | rule | ||
) |
Sets the shape's fill rule.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[in] | rule | The fill rule value. The default value is TVG_FILL_RULE_WINDING . |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid Tvg_Paint pointer. |
TVG_EXPORT Tvg_Result tvg_shape_set_linear_gradient | ( | Tvg_Paint * | paint, |
Tvg_Gradient * | grad | ||
) |
Sets the linear gradient fill for all of the figures from the path.
The parts of the shape defined as inner are filled.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[in] | grad | The linear gradient fill. |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid Tvg_Paint pointer. |
TVG_RESULT_MEMORY_CORRUPTION | An invalid Tvg_Gradient pointer. |
TVG_EXPORT Tvg_Result tvg_shape_set_radial_gradient | ( | Tvg_Paint * | paint, |
Tvg_Gradient * | grad | ||
) |
Sets the radial gradient fill for all of the figures from the path.
The parts of the shape defined as inner are filled.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[in] | grad | The radial gradient fill. |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid Tvg_Paint pointer. |
TVG_RESULT_MEMORY_CORRUPTION | An invalid Tvg_Gradient pointer. |
TVG_EXPORT Tvg_Result tvg_shape_set_stroke_cap | ( | Tvg_Paint * | paint, |
Tvg_Stroke_Cap | cap | ||
) |
Sets the cap style used for stroking the path.
The cap style specifies the shape to be used at the end of the open stroked sub-paths.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[in] | cap | The cap style value. The default value is TVG_STROKE_CAP_SQUARE . |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid Tvg_Paint pointer. |
TVG_RESULT_FAILED_ALLOCATION | An internal error with a memory allocation. |
TVG_EXPORT Tvg_Result tvg_shape_set_stroke_color | ( | Tvg_Paint * | paint, |
uint8_t | r, | ||
uint8_t | g, | ||
uint8_t | b, | ||
uint8_t | a | ||
) |
Sets the shape's stroke color.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[in] | r | The red color channel value in the range [0 ~ 255]. The default value is 0. |
[in] | g | The green color channel value in the range [0 ~ 255]. The default value is 0. |
[in] | b | The blue color channel value in the range [0 ~ 255]. The default value is 0. |
[in] | a | The alpha channel value in the range [0 ~ 255], where 0 is completely transparent and 255 is opaque. |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid Tvg_Paint pointer. |
TVG_RESULT_FAILED_ALLOCATION | An internal error with a memory allocation. |
TVG_EXPORT Tvg_Result tvg_shape_set_stroke_dash | ( | Tvg_Paint * | paint, |
const float * | dashPattern, | ||
uint32_t | cnt | ||
) |
Sets the shape's stroke dash pattern.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[in] | dashPattern | The array of consecutive pair values of the dash length and the gap length. |
[in] | cnt | The size of the dashPattern array. |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid pointer passed as an argument and cnt > 0, the given length of the array is less than two or any of the dashPattern values is zero or less. |
TVG_RESULT_FAILED_ALLOCATION | An internal error with a memory allocation. |
nullptr
to dashPattern
and zero to cnt
. TVG_EXPORT Tvg_Result tvg_shape_set_stroke_join | ( | Tvg_Paint * | paint, |
Tvg_Stroke_Join | join | ||
) |
Sets the join style for stroked path segments.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[in] | join | The join style value. The default value is TVG_STROKE_JOIN_BEVEL . |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid Tvg_Paint pointer. |
TVG_RESULT_FAILED_ALLOCATION | An internal error with a memory allocation. |
TVG_EXPORT Tvg_Result tvg_shape_set_stroke_linear_gradient | ( | Tvg_Paint * | paint, |
Tvg_Gradient * | grad | ||
) |
Sets the linear gradient fill of the stroke for all of the figures from the path.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[in] | grad | The linear gradient fill. |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid Tvg_Paint pointer. |
TVG_RESULT_FAILED_ALLOCATION | An internal error with a memory allocation. |
TVG_RESULT_MEMORY_CORRUPTION | An invalid Tvg_Gradient pointer. |
TVG_EXPORT Tvg_Result tvg_shape_set_stroke_radial_gradient | ( | Tvg_Paint * | paint, |
Tvg_Gradient * | grad | ||
) |
Sets the radial gradient fill of the stroke for all of the figures from the path.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[in] | grad | The radial gradient fill. |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid Tvg_Paint pointer. |
TVG_RESULT_FAILED_ALLOCATION | An internal error with a memory allocation. |
TVG_RESULT_MEMORY_CORRUPTION | An invalid Tvg_Gradient pointer. |
TVG_EXPORT Tvg_Result tvg_shape_set_stroke_width | ( | Tvg_Paint * | paint, |
float | width | ||
) |
Sets the stroke width for all of the figures from the paint
.
[in] | paint | A Tvg_Paint pointer to the shape object. |
[in] | width | The width of the stroke. The default value is 0. |
TVG_RESULT_SUCCESS | Succeed. |
TVG_RESULT_INVALID_ARGUMENT | An invalid Tvg_Paint pointer. |
TVG_RESULT_FAILED_ALLOCATION | An internal error with a memory allocation. |