| ThorVG v0.1

thorvg_capi.h
1
19 #ifndef __THORVG_CAPI_H__
20 #define __THORVG_CAPI_H__
21
22 #include <stdbool.h>
23
24 #ifdef TVG_EXPORT
25 #undef TVG_EXPORT
26 #endif
27
28 #ifdef TVG_BUILD
29 #define TVG_EXPORT __attribute__ ((visibility ("default")))
30 #else
31 #define TVG_EXPORT
32 #endif
33
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
51 #define TVG_ENGINE_SW (1 << 1)
52
53
59 #define TVG_ENGINE_GL (1 << 2)
60
61
67 #define TVG_COLORSPACE_ABGR8888 0
68
69
75 #define TVG_COLORSPACE_ARGB8888 1
76
77
83 typedef struct _Tvg_Canvas Tvg_Canvas;
84
85
91 typedef struct _Tvg_Paint Tvg_Paint;
92
93
97 typedef struct _Tvg_Gradient Tvg_Gradient;
98
99
103 typedef enum {
104 TVG_RESULT_SUCCESS = 0,
105 TVG_RESULT_INVALID_ARGUMENT,
106 TVG_RESULT_INSUFFICIENT_CONDITION,
107 TVG_RESULT_FAILED_ALLOCATION,
108 TVG_RESULT_MEMORY_CORRUPTION,
109 TVG_RESULT_NOT_SUPPORTED,
110 TVG_RESULT_UNKNOWN
111 } Tvg_Result;
112
113
119 typedef enum {
120 TVG_COMPOSITE_METHOD_NONE = 0,
121 TVG_COMPOSITE_METHOD_CLIP_PATH,
122 TVG_COMPOSITE_METHOD_ALPHA_MASK,
123 TVG_COMPOSITE_METHOD_INVERSE_ALPHA_MASK,
124 } Tvg_Composite_Method;
125
126
138 typedef enum {
139 TVG_PATH_COMMAND_CLOSE = 0,
140 TVG_PATH_COMMAND_MOVE_TO,
141 TVG_PATH_COMMAND_LINE_TO,
142 TVG_PATH_COMMAND_CUBIC_TO
143 } Tvg_Path_Command;
144
145
149 typedef enum {
150 TVG_STROKE_CAP_SQUARE = 0,
151 TVG_STROKE_CAP_ROUND,
152 TVG_STROKE_CAP_BUTT
153 } Tvg_Stroke_Cap;
154
155
159 typedef enum {
160 TVG_STROKE_JOIN_BEVEL = 0,
161 TVG_STROKE_JOIN_ROUND,
162 TVG_STROKE_JOIN_MITER
163 } Tvg_Stroke_Join;
164
165
169 typedef enum {
170 TVG_STROKE_FILL_PAD = 0,
171 TVG_STROKE_FILL_REFLECT,
172 TVG_STROKE_FILL_REPEAT
173 } Tvg_Stroke_Fill;
174
175
179 typedef enum {
180 TVG_FILL_RULE_WINDING = 0,
181 TVG_FILL_RULE_EVEN_ODD
182 } Tvg_Fill_Rule;
183 // end addtogroup ThorVGCapi_Shape
185
186
195 typedef struct
196 {
197 float offset;
198 uint8_t r;
199 uint8_t g;
200 uint8_t b;
201 uint8_t a;
202 } Tvg_Color_Stop;
203 // end addtogroup ThorVGCapi_Gradient
205
206
210 typedef struct
211 {
212 float x, y;
213 } Tvg_Point;
214
215
219 typedef struct
220 {
221 float e11, e12, e13;
222 float e21, e22, e23;
223 float e31, e32, e33;
224 } Tvg_Matrix;
225
226
234 /************************************************************************/
235 /* Engine API */
236 /************************************************************************/
262 TVG_EXPORT Tvg_Result tvg_engine_init(unsigned engine_method, unsigned threads);
263
264
290 TVG_EXPORT Tvg_Result tvg_engine_term(unsigned engine_method);
291
292 // end defgroup ThorVGCapi_Initializer
294
295
313 /************************************************************************/
314 /* SwCanvas API */
315 /************************************************************************/
340 TVG_EXPORT Tvg_Canvas* tvg_swcanvas_create();
341
342
366 TVG_EXPORT Tvg_Result tvg_swcanvas_set_target(Tvg_Canvas* canvas, uint32_t* buffer, uint32_t stride, uint32_t w, uint32_t h, uint32_t cs);
367
368 // end defgroup ThorVGCapi_SwCanvas
370
371
372 /************************************************************************/
373 /* Common Canvas API */
374 /************************************************************************/
436 TVG_EXPORT Tvg_Result tvg_canvas_destroy(Tvg_Canvas* canvas);
437
438
457 TVG_EXPORT Tvg_Result tvg_canvas_push(Tvg_Canvas* canvas, Tvg_Paint* paint);
458
459
490 TVG_EXPORT Tvg_Result tvg_canvas_reserve(Tvg_Canvas* canvas, uint32_t n);
491
492
510 TVG_EXPORT Tvg_Result tvg_canvas_clear(Tvg_Canvas* canvas, bool free);
511
512
568 TVG_EXPORT Tvg_Result tvg_canvas_update(Tvg_Canvas* canvas);
569
570
584 TVG_EXPORT Tvg_Result tvg_canvas_update_paint(Tvg_Canvas* canvas, Tvg_Paint* paint);
585
586
602 TVG_EXPORT Tvg_Result tvg_canvas_draw(Tvg_Canvas* canvas);
603
604
618 TVG_EXPORT Tvg_Result tvg_canvas_sync(Tvg_Canvas* canvas);
619
620 // end defgroup ThorVGCapi_Canvas
622
623
631 /************************************************************************/
632 /* Paint API */
633 /************************************************************************/
664 TVG_EXPORT Tvg_Result tvg_paint_del(Tvg_Paint* paint);
665
666
678 TVG_EXPORT Tvg_Result tvg_paint_scale(Tvg_Paint* paint, float factor);
679
680
692 TVG_EXPORT Tvg_Result tvg_paint_rotate(Tvg_Paint* paint, float degree);
693
694
707 TVG_EXPORT Tvg_Result tvg_paint_translate(Tvg_Paint* paint, float x, float y);
708
709
721 TVG_EXPORT Tvg_Result tvg_paint_transform(Tvg_Paint* paint, const Tvg_Matrix* m);
722
723
736 TVG_EXPORT Tvg_Result tvg_paint_set_opacity(Tvg_Paint* paint, uint8_t opacity);
737
738
749 TVG_EXPORT Tvg_Result tvg_paint_get_opacity(Tvg_Paint* paint, uint8_t* opacity);
750
751
761 TVG_EXPORT Tvg_Paint* tvg_paint_duplicate(Tvg_Paint* paint);
762
763
778 TVG_EXPORT Tvg_Result tvg_paint_get_bounds(const Tvg_Paint* paint, float* x, float* y, float* w, float* h);
779
780
792 TVG_EXPORT Tvg_Result tvg_paint_set_composite_method(Tvg_Paint* paint, Tvg_Paint* target, Tvg_Composite_Method method);
793
794 // end defgroup ThorVGCapi_Paint
796
797
813 /************************************************************************/
814 /* Shape API */
815 /************************************************************************/
821 TVG_EXPORT Tvg_Paint* tvg_shape_new();
822
823
837 TVG_EXPORT Tvg_Result tvg_shape_reset(Tvg_Paint* paint);
838
839
853 TVG_EXPORT Tvg_Result tvg_shape_move_to(Tvg_Paint* paint, float x, float y);
854
855
871 TVG_EXPORT Tvg_Result tvg_shape_line_to(Tvg_Paint* paint, float x, float y);
872
873
894 TVG_EXPORT Tvg_Result tvg_shape_cubic_to(Tvg_Paint* paint, float cx1, float cy1, float cx2, float cy2, float x, float y);
895
896
910 TVG_EXPORT Tvg_Result tvg_shape_close(Tvg_Paint* paint);
911
912
940 TVG_EXPORT Tvg_Result tvg_shape_append_rect(Tvg_Paint* paint, float x, float y, float w, float h, float rx, float ry);
941
942
962 TVG_EXPORT Tvg_Result tvg_shape_append_circle(Tvg_Paint* paint, float cx, float cy, float rx, float ry);
963
964
985 TVG_EXPORT Tvg_Result tvg_shape_append_arc(Tvg_Paint* paint, float cx, float cy, float radius, float startAngle, float sweep, uint8_t pie);
986
987
1004 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);
1005
1006
1030 TVG_EXPORT Tvg_Result tvg_shape_get_path_coords(const Tvg_Paint* paint, const Tvg_Point** pts, uint32_t* cnt);
1031
1032
1056 TVG_EXPORT Tvg_Result tvg_shape_get_path_commands(const Tvg_Paint* paint, const Tvg_Path_Command** cmds, uint32_t* cnt);
1057
1058
1070 TVG_EXPORT Tvg_Result tvg_shape_set_stroke_width(Tvg_Paint* paint, float width);
1071
1072
1083 TVG_EXPORT Tvg_Result tvg_shape_get_stroke_width(const Tvg_Paint* paint, float* width);
1084
1085
1102 TVG_EXPORT Tvg_Result tvg_shape_set_stroke_color(Tvg_Paint* paint, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
1103
1104
1118 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);
1119
1120
1135 TVG_EXPORT Tvg_Result tvg_shape_set_stroke_linear_gradient(Tvg_Paint* paint, Tvg_Gradient* grad);
1136
1137
1152 TVG_EXPORT Tvg_Result tvg_shape_set_stroke_radial_gradient(Tvg_Paint* paint, Tvg_Gradient* grad);
1153
1154
1167 TVG_EXPORT Tvg_Result tvg_shape_get_stroke_gradient(const Tvg_Paint* paint, Tvg_Gradient** grad);
1168
1169
1189 TVG_EXPORT Tvg_Result tvg_shape_set_stroke_dash(Tvg_Paint* paint, const float* dashPattern, uint32_t cnt);
1190
1191
1205 TVG_EXPORT Tvg_Result tvg_shape_get_stroke_dash(const Tvg_Paint* paint, const float** dashPattern, uint32_t* cnt);
1206
1207
1221 TVG_EXPORT Tvg_Result tvg_shape_set_stroke_cap(Tvg_Paint* paint, Tvg_Stroke_Cap cap);
1222
1223
1234 TVG_EXPORT Tvg_Result tvg_shape_get_stroke_cap(const Tvg_Paint* paint, Tvg_Stroke_Cap* cap);
1235
1236
1248 TVG_EXPORT Tvg_Result tvg_shape_set_stroke_join(Tvg_Paint* paint, Tvg_Stroke_Join join);
1249
1250
1261 TVG_EXPORT Tvg_Result tvg_shape_get_stroke_join(const Tvg_Paint* paint, Tvg_Stroke_Join* join);
1262
1263
1282 TVG_EXPORT Tvg_Result tvg_shape_set_fill_color(Tvg_Paint* paint, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
1283
1284
1298 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);
1299
1300
1311 TVG_EXPORT Tvg_Result tvg_shape_set_fill_rule(Tvg_Paint* paint, Tvg_Fill_Rule rule);
1312
1313
1324 TVG_EXPORT Tvg_Result tvg_shape_get_fill_rule(const Tvg_Paint* paint, Tvg_Fill_Rule* rule);
1325
1326
1357 TVG_EXPORT Tvg_Result tvg_shape_set_linear_gradient(Tvg_Paint* paint, Tvg_Gradient* grad);
1358
1359
1390 TVG_EXPORT Tvg_Result tvg_shape_set_radial_gradient(Tvg_Paint* paint, Tvg_Gradient* grad);
1391
1392
1405 TVG_EXPORT Tvg_Result tvg_shape_get_gradient(const Tvg_Paint* paint, Tvg_Gradient** grad);
1406
1407 // end defgroup ThorVGCapi_Shape
1409
1410
1422 /************************************************************************/
1423 /* Gradient API */
1424 /************************************************************************/
1444 TVG_EXPORT Tvg_Gradient* tvg_linear_gradient_new();
1445
1446
1466 TVG_EXPORT Tvg_Gradient* tvg_radial_gradient_new();
1467
1468
1486 TVG_EXPORT Tvg_Result tvg_linear_gradient_set(Tvg_Gradient* grad, float x1, float y1, float x2, float y2);
1487
1488
1506 TVG_EXPORT Tvg_Result tvg_linear_gradient_get(Tvg_Gradient* grad, float* x1, float* y1, float* x2, float* y2);
1507
1508
1523 TVG_EXPORT Tvg_Result tvg_radial_gradient_set(Tvg_Gradient* grad, float cx, float cy, float radius);
1524
1525
1538 TVG_EXPORT Tvg_Result tvg_radial_gradient_get(Tvg_Gradient* grad, float* cx, float* cy, float* radius);
1539
1540
1552 TVG_EXPORT Tvg_Result tvg_gradient_set_color_stops(Tvg_Gradient* grad, const Tvg_Color_Stop* color_stop, uint32_t cnt);
1553
1554
1568 TVG_EXPORT Tvg_Result tvg_gradient_get_color_stops(Tvg_Gradient* grad, const Tvg_Color_Stop** color_stop, uint32_t* cnt);
1569
1570
1581 TVG_EXPORT Tvg_Result tvg_gradient_set_spread(Tvg_Gradient* grad, const Tvg_Stroke_Fill spread);
1582
1583
1594 TVG_EXPORT Tvg_Result tvg_gradient_get_spread(Tvg_Gradient* grad, Tvg_Stroke_Fill* spread);
1595
1596
1606 TVG_EXPORT Tvg_Result tvg_gradient_del(Tvg_Gradient* grad);
1607
1608 // end defgroup ThorVGCapi_Gradient
1610
1611
1621 /************************************************************************/
1622 /* Picture API */
1623 /************************************************************************/
1629 TVG_EXPORT Tvg_Paint* tvg_picture_new();
1630
1631
1644 TVG_EXPORT Tvg_Result tvg_picture_load(Tvg_Paint* paint, const char* path);
1645
1646
1652 TVG_EXPORT Tvg_Result tvg_picture_load_raw(Tvg_Paint* paint, uint32_t *data, uint32_t w, uint32_t h, bool copy);
1653
1654
1660 TVG_EXPORT Tvg_Result tvg_picture_get_viewbox(const Tvg_Paint* paint, float* x, float* y, float* w, float* h);
1661
1662 // end defgroup ThorVGCapi_Picture
1664
1665
1676 /************************************************************************/
1677 /* Scene API */
1678 /************************************************************************/
1686 TVG_EXPORT Tvg_Paint* tvg_scene_new();
1687
1688
1702 TVG_EXPORT Tvg_Result tvg_scene_reserve(Tvg_Paint* scene, uint32_t size);
1703
1704
1723 TVG_EXPORT Tvg_Result tvg_scene_push(Tvg_Paint* scene, Tvg_Paint* paint);
1724
1725
1731 TVG_EXPORT Tvg_Result tvg_scene_clear(Tvg_Paint* scene);
1732
1733 // end defgroup ThorVGCapi_Scene
1735
1736 // end defgroup ThorVG_CAPI
1738
1739
1740 #ifdef __cplusplus
1741 }
1742 #endif
1743
1744 #endif //_THORVG_CAPI_H_
tvg_canvas_destroy
TVG_EXPORT Tvg_Result tvg_canvas_destroy(Tvg_Canvas *canvas)
Clears the canvas internal data, releases all paints stored by the canvas and destroys the canvas obj...
tvg_canvas_sync
TVG_EXPORT Tvg_Result tvg_canvas_sync(Tvg_Canvas *canvas)
Guarantees the drawing process is finished.
Tvg_Paint
struct _Tvg_Paint Tvg_Paint
A structure representing a graphical element.
Definition: thorvg_capi.h:91
tvg_shape_get_stroke_width
TVG_EXPORT Tvg_Result tvg_shape_get_stroke_width(const Tvg_Paint *paint, float *width)
Gets the shape&#39;s stroke width.
tvg_engine_init
TVG_EXPORT Tvg_Result tvg_engine_init(unsigned engine_method, unsigned threads)
Initializes TVG engines.
tvg_scene_reserve
TVG_EXPORT Tvg_Result tvg_scene_reserve(Tvg_Paint *scene, uint32_t size)
Sets the size of the container, where all the paints pushed into the scene are stored.
Tvg_Stroke_Join
Tvg_Stroke_Join
Enumeration specifying how to fill the area outside the gradient bounds.
Definition: thorvg_capi.h:159
tvg_shape_append_rect
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.
tvg_shape_set_fill_rule
TVG_EXPORT Tvg_Result tvg_shape_set_fill_rule(Tvg_Paint *paint, Tvg_Fill_Rule rule)
Sets the shape&#39;s fill rule.
tvg_picture_load
TVG_EXPORT Tvg_Result tvg_picture_load(Tvg_Paint *paint, const char *path)
Loads a picture data directly from a file.
tvg_shape_get_stroke_join
TVG_EXPORT Tvg_Result tvg_shape_get_stroke_join(const Tvg_Paint *paint, Tvg_Stroke_Join *join)
The function gets the stroke join method.
TVG_STROKE_JOIN_BEVEL
The outer corner of the joined path segments is bevelled at the join point. The triangular region of ...
Definition: thorvg_capi.h:160
tvg_shape_set_fill_color
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&#39;s solid color.
tvg_shape_set_stroke_radial_gradient
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. ...
tvg_canvas_clear
TVG_EXPORT Tvg_Result tvg_canvas_clear(Tvg_Canvas *canvas, bool free)
Clears a Tvg_Canvas objects from pushed paints.
TVG_FILL_RULE_WINDING
A line from the point to a location outside the shape is drawn. The intersections of the line with th...
Definition: thorvg_capi.h:180
TVG_COMPOSITE_METHOD_CLIP_PATH
The intersection of the source and the target is determined and only the resulting pixels from the so...
Definition: thorvg_capi.h:121
tvg_swcanvas_set_target
TVG_EXPORT Tvg_Result tvg_swcanvas_set_target(Tvg_Canvas *canvas, uint32_t *buffer, uint32_t stride, uint32_t w, uint32_t h, uint32_t cs)
Sets the buffer used in the rasterization process and defines the used colorspace.
Tvg_Result
Tvg_Result
Enumeration specifying the result from the APIs.
Definition: thorvg_capi.h:103
TVG_STROKE_FILL_REPEAT
The gradient pattern is repeated continuously beyond the gradient area until the expected region is f...
Definition: thorvg_capi.h:172
TVG_RESULT_SUCCESS
The value returned in case of a correct request execution.
Definition: thorvg_capi.h:104
tvg_shape_get_path_coords
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.
Tvg_Color_Stop::r
uint8_t r
Definition: thorvg_capi.h:198
tvg_shape_get_path_commands
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.
tvg_scene_new
TVG_EXPORT Tvg_Paint * tvg_scene_new()
Creates a new scene object.
TVG_RESULT_INSUFFICIENT_CONDITION
The value returned in case the request cannot be processed - e.g. asking for properties of an object...
Definition: thorvg_capi.h:106
tvg_paint_get_bounds
TVG_EXPORT Tvg_Result tvg_paint_get_bounds(const Tvg_Paint *paint, float *x, float *y, float *w, float *h)
Gets the bounding box of the Tvg_Paint object before any transformation.
tvg_radial_gradient_get
TVG_EXPORT Tvg_Result tvg_radial_gradient_get(Tvg_Gradient *grad, float *cx, float *cy, float *radius)
The function gets radial gradient center point ant radius.
tvg_shape_get_gradient
TVG_EXPORT Tvg_Result tvg_shape_get_gradient(const Tvg_Paint *paint, Tvg_Gradient **grad)
Gets the gradient fill of the shape.
Tvg_Color_Stop
A data structure storing the information about the color and its relative position inside the gradien...
Definition: thorvg_capi.h:195
Tvg_Path_Command
Tvg_Path_Command
Enumeration specifying the values of the path commands accepted by TVG.
Definition: thorvg_capi.h:138
tvg_shape_get_stroke_gradient
TVG_EXPORT Tvg_Result tvg_shape_get_stroke_gradient(const Tvg_Paint *paint, Tvg_Gradient **grad)
Gets the gradient fill of the shape&#39;s stroke.
tvg_shape_cubic_to
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.
tvg_shape_set_stroke_join
TVG_EXPORT Tvg_Result tvg_shape_set_stroke_join(Tvg_Paint *paint, Tvg_Stroke_Join join)
Sets the join style for stroked path segments.
tvg_linear_gradient_new
TVG_EXPORT Tvg_Gradient * tvg_linear_gradient_new()
Creates a new linear gradient object.
Tvg_Color_Stop::a
uint8_t a
Definition: thorvg_capi.h:201
Tvg_Fill_Rule
Tvg_Fill_Rule
Enumeration specifying the algorithm used to establish which parts of the shape are treated as the in...
Definition: thorvg_capi.h:179
tvg_shape_close
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-...
TVG_COMPOSITE_METHOD_INVERSE_ALPHA_MASK
The pixels of the source and the complement to the target&#39;s pixels are alpha blended. As a result, only the part of the source which is not covered by the target is visible.
Definition: thorvg_capi.h:123
tvg_linear_gradient_set
TVG_EXPORT Tvg_Result tvg_linear_gradient_set(Tvg_Gradient *grad, float x1, float y1, float x2, float y2)
Sets the linear gradient bounds.
tvg_shape_set_radial_gradient
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.
tvg_shape_reset
TVG_EXPORT Tvg_Result tvg_shape_reset(Tvg_Paint *paint)
Resets the shape path properties.
Tvg_Color_Stop::g
uint8_t g
Definition: thorvg_capi.h:199
Tvg_Matrix
A data structure representing a three-dimensional matrix.
Definition: thorvg_capi.h:219
TVG_STROKE_JOIN_ROUND
The outer corner of the joined path segments is rounded. The circular region is centered at the join ...
Definition: thorvg_capi.h:161
tvg_shape_set_stroke_linear_gradient
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. ...
tvg_radial_gradient_set
TVG_EXPORT Tvg_Result tvg_radial_gradient_set(Tvg_Gradient *grad, float cx, float cy, float radius)
Sets the radial gradient bounds.
tvg_paint_duplicate
TVG_EXPORT Tvg_Paint * tvg_paint_duplicate(Tvg_Paint *paint)
Duplicates the given Tvg_Paint object.
tvg_picture_get_viewbox
TVG_EXPORT Tvg_Result tvg_picture_get_viewbox(const Tvg_Paint *paint, float *x, float *y, float *w, float *h)
Gets the position and the size of the loaded picture. (BETA version)
Tvg_Stroke_Cap
Tvg_Stroke_Cap
Enumeration determining the ending type of a stroke in the open sub-paths.
Definition: thorvg_capi.h:149
tvg_picture_new
TVG_EXPORT Tvg_Paint * tvg_picture_new()
Creates a new picture object.
tvg_paint_get_opacity
TVG_EXPORT Tvg_Result tvg_paint_get_opacity(Tvg_Paint *paint, uint8_t *opacity)
Gets the opacity of the given Tvg_Paint.
TVG_STROKE_CAP_SQUARE
The stroke is extended in both endpoints of a sub-path by a rectangle, with the width equal to the st...
Definition: thorvg_capi.h:150
TVG_COMPOSITE_METHOD_NONE
No composition is applied.
Definition: thorvg_capi.h:120
TVG_RESULT_INVALID_ARGUMENT
The value returned in the event of a problem with the arguments given to the API - e...
Definition: thorvg_capi.h:105
tvg_radial_gradient_new
TVG_EXPORT Tvg_Gradient * tvg_radial_gradient_new()
Creates a new radial gradient object.
tvg_shape_new
TVG_EXPORT Tvg_Paint * tvg_shape_new()
Creates a new shape object.
TVG_RESULT_MEMORY_CORRUPTION
The value returned in the event of bad memory handling - e.g. failing in pointer releasing or casting...
Definition: thorvg_capi.h:108
tvg_shape_get_stroke_dash
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.
tvg_scene_push
TVG_EXPORT Tvg_Result tvg_scene_push(Tvg_Paint *scene, Tvg_Paint *paint)
Passes drawing elements to the scene using Tvg_Paint objects.
tvg_paint_del
TVG_EXPORT Tvg_Result tvg_paint_del(Tvg_Paint *paint)
Releases the given Tvg_Paint object.
tvg_shape_append_circle
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.
tvg_canvas_update
TVG_EXPORT Tvg_Result tvg_canvas_update(Tvg_Canvas *canvas)
Updates all paints in a canvas.
TVG_PATH_COMMAND_MOVE_TO
Sets a new initial point of the sub-path and a new current point - corresponds to M command in the sv...
Definition: thorvg_capi.h:140
TVG_STROKE_CAP_ROUND
The stroke is extended in both endpoints of a sub-path by a half circle, with a radius equal to the h...
Definition: thorvg_capi.h:151
TVG_STROKE_JOIN_MITER
The outer corner of the joined path segments is spiked. The spike is created by extension beyond the ...
Definition: thorvg_capi.h:162
Tvg_Stroke_Fill
Tvg_Stroke_Fill
Enumeration specifying how to fill the area outside the gradient bounds.
Definition: thorvg_capi.h:169
tvg_gradient_set_color_stops
TVG_EXPORT Tvg_Result tvg_gradient_set_color_stops(Tvg_Gradient *grad, const Tvg_Color_Stop *color_stop, uint32_t cnt)
Sets the parameters of the colors of the gradient and their position.
tvg_gradient_set_spread
TVG_EXPORT Tvg_Result tvg_gradient_set_spread(Tvg_Gradient *grad, const Tvg_Stroke_Fill spread)
Sets the Tvg_Stroke_Fill value, which specifies how to fill the area outside the gradient bounds...
Tvg_Composite_Method
Tvg_Composite_Method
Enumeration indicating the method used in the composition of two objects - the target and the source...
Definition: thorvg_capi.h:119
tvg_shape_get_fill_rule
TVG_EXPORT Tvg_Result tvg_shape_get_fill_rule(const Tvg_Paint *paint, Tvg_Fill_Rule *rule)
Gets the shape&#39;s fill rule.
TVG_STROKE_FILL_REFLECT
The gradient pattern is reflected outside the gradient area until the expected region is filled...
Definition: thorvg_capi.h:171
tvg_shape_move_to
TVG_EXPORT Tvg_Result tvg_shape_move_to(Tvg_Paint *paint, float x, float y)
Sets the initial point of the sub-path.
tvg_canvas_update_paint
TVG_EXPORT Tvg_Result tvg_canvas_update_paint(Tvg_Canvas *canvas, Tvg_Paint *paint)
Updates the given Tvg_Paint object from the canvas before the rendering.
TVG_RESULT_UNKNOWN
The value returned in all other cases.
Definition: thorvg_capi.h:110
TVG_FILL_RULE_EVEN_ODD
A line from the point to a location outside the shape is drawn and its intersections with the path se...
Definition: thorvg_capi.h:181
TVG_PATH_COMMAND_LINE_TO
Draws a line from the current point to the given point and sets a new value of the current point - co...
Definition: thorvg_capi.h:141
tvg_canvas_push
TVG_EXPORT Tvg_Result tvg_canvas_push(Tvg_Canvas *canvas, Tvg_Paint *paint)
Inserts a drawing element into the canvas using a Tvg_Paint object.
Tvg_Color_Stop::offset
float offset
Definition: thorvg_capi.h:197
tvg_shape_get_stroke_cap
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.
tvg_linear_gradient_get
TVG_EXPORT Tvg_Result tvg_linear_gradient_get(Tvg_Gradient *grad, float *x1, float *y1, float *x2, float *y2)
Gets the linear gradient bounds.
tvg_gradient_get_spread
TVG_EXPORT Tvg_Result tvg_gradient_get_spread(Tvg_Gradient *grad, Tvg_Stroke_Fill *spread)
Gets the FillSpread value of the gradient object.
tvg_paint_scale
TVG_EXPORT Tvg_Result tvg_paint_scale(Tvg_Paint *paint, float factor)
Scales the given Tvg_Paint object by the given factor.
tvg_swcanvas_create
TVG_EXPORT Tvg_Canvas * tvg_swcanvas_create()
Creates a Canvas object.
tvg_shape_set_stroke_dash
TVG_EXPORT Tvg_Result tvg_shape_set_stroke_dash(Tvg_Paint *paint, const float *dashPattern, uint32_t cnt)
Sets the shape&#39;s stroke dash pattern.
tvg_canvas_draw
TVG_EXPORT Tvg_Result tvg_canvas_draw(Tvg_Canvas *canvas)
The function start rendering process.
tvg_paint_rotate
TVG_EXPORT Tvg_Result tvg_paint_rotate(Tvg_Paint *paint, float degree)
Rotates the given Tvg_Paint by the given angle.
TVG_RESULT_FAILED_ALLOCATION
The value returned in case of unsuccessful memory allocation.
Definition: thorvg_capi.h:107
tvg_shape_get_fill_color
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&#39;s solid color.
TVG_COMPOSITE_METHOD_ALPHA_MASK
The pixels of the source and the target are alpha blended. As a result, only the part of the source...
Definition: thorvg_capi.h:122
tvg_shape_set_stroke_cap
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.
TVG_STROKE_CAP_BUTT
The stroke ends exactly at each of the two endpoints of a sub-path. For zero length sub-paths no stro...
Definition: thorvg_capi.h:152
tvg_engine_term
TVG_EXPORT Tvg_Result tvg_engine_term(unsigned engine_method)
Terminates TVG engines.
tvg_shape_set_stroke_color
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&#39;s stroke color.
Tvg_Point
A data structure representing a point in two-dimensional space.
Definition: thorvg_capi.h:210
TVG_PATH_COMMAND_CUBIC_TO
Draws a cubic Bezier curve from the current point to the given point using two given control points a...
Definition: thorvg_capi.h:142
TVG_STROKE_FILL_PAD
The remaining area is filled with the closest stop color.
Definition: thorvg_capi.h:170
tvg_shape_append_arc
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.
Tvg_Color_Stop::b
uint8_t b
Definition: thorvg_capi.h:200
tvg_shape_get_stroke_color
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&#39;s stroke color.
tvg_shape_set_stroke_width
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.
tvg_paint_set_opacity
TVG_EXPORT Tvg_Result tvg_paint_set_opacity(Tvg_Paint *paint, uint8_t opacity)
Sets the opacity of the given Tvg_Paint.
TVG_RESULT_NOT_SUPPORTED
The value returned in case of choosing unsupported options.
Definition: thorvg_capi.h:109
tvg_scene_clear
TVG_EXPORT Tvg_Result tvg_scene_clear(Tvg_Paint *scene)
Sets the total number of the paints pushed into the scene to be zero. (BETA version) ...
tvg_gradient_del
TVG_EXPORT Tvg_Result tvg_gradient_del(Tvg_Gradient *grad)
Deletes the given gradient object.
tvg_gradient_get_color_stops
TVG_EXPORT Tvg_Result tvg_gradient_get_color_stops(Tvg_Gradient *grad, const Tvg_Color_Stop **color_stop, uint32_t *cnt)
Gets the parameters of the colors of the gradient, their position and number.
tvg_picture_load_raw
TVG_EXPORT Tvg_Result tvg_picture_load_raw(Tvg_Paint *paint, uint32_t *data, uint32_t w, uint32_t h, bool copy)
Loads a picture data from a memory block of a given size. (BETA version)
tvg_paint_set_composite_method
TVG_EXPORT Tvg_Result tvg_paint_set_composite_method(Tvg_Paint *paint, Tvg_Paint *target, Tvg_Composite_Method method)
Sets the composition target object and the composition method.
TVG_PATH_COMMAND_CLOSE
Ends the current sub-path and connects it with its initial point - corresponds to Z command in the sv...
Definition: thorvg_capi.h:139
Tvg_Canvas
struct _Tvg_Canvas Tvg_Canvas
A structure responsible for managing and drawing graphical elements.
Definition: thorvg_capi.h:83
tvg_shape_append_path
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.
tvg_paint_transform
TVG_EXPORT Tvg_Result tvg_paint_transform(Tvg_Paint *paint, const Tvg_Matrix *m)
Transforms the given Tvg_Paint using the augmented transformation matrix.
tvg_shape_set_linear_gradient
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.
tvg_canvas_reserve
TVG_EXPORT Tvg_Result tvg_canvas_reserve(Tvg_Canvas *canvas, uint32_t n)
Reserves a memory block where the objects pushed into a canvas are stored.
tvg_shape_line_to
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...
Tvg_Gradient
struct _Tvg_Gradient Tvg_Gradient
A structure representing a gradient fill of a Tvg_Paint object.
Definition: thorvg_capi.h:97
tvg_paint_translate
TVG_EXPORT Tvg_Result tvg_paint_translate(Tvg_Paint *paint, float x, float y)
Moves the given Tvg_Paint in a two-dimensional space.