ThorVG  v0.10
thorvg_capi.h
1 
18 #ifndef __THORVG_CAPI_H__
19 #define __THORVG_CAPI_H__
20 
21 #include <stdint.h>
22 #include <stdbool.h>
23 
24 #ifdef TVG_API
25  #undef TVG_API
26 #endif
27 
28 #ifndef TVG_STATIC
29  #ifdef _WIN32
30  #if TVG_BUILD
31  #define TVG_API __declspec(dllexport)
32  #else
33  #define TVG_API __declspec(dllimport)
34  #endif
35  #elif (defined(__SUNPRO_C) || defined(__SUNPRO_CC))
36  #define TVG_API __global
37  #else
38  #if (defined(__GNUC__) && __GNUC__ >= 4) || defined(__INTEL_COMPILER)
39  #define TVG_API __attribute__ ((visibility("default")))
40  #else
41  #define TVG_API
42  #endif
43  #endif
44 #else
45  #define TVG_API
46 #endif
47 
48 #ifdef TVG_DEPRECATED
49  #undef TVG_DEPRECATED
50 #endif
51 
52 #ifdef _WIN32
53  #define TVG_DEPRECATED __declspec(deprecated)
54 #elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
55  #define TVG_DEPRECATED __attribute__ ((__deprecated__))
56 #else
57  #define TVG_DEPRECATED
58 #endif
59 
60 #ifdef __cplusplus
61 extern "C" {
62 #endif
63 
77 typedef struct _Tvg_Canvas Tvg_Canvas;
78 
79 
85 typedef struct _Tvg_Paint Tvg_Paint;
86 
87 
91 typedef struct _Tvg_Gradient Tvg_Gradient;
92 
93 
97 typedef struct _Tvg_Saver Tvg_Saver;
98 
99 
105 typedef enum {
106  TVG_ENGINE_SW = (1 << 1),
107  TVG_ENGINE_GL = (1 << 2)
109 
110 
114 typedef enum {
123 
124 
130 typedef enum {
137 
138 
146 typedef enum {
154 
155 
167 typedef enum {
173 
174 
178 typedef enum {
183 
184 
188 typedef enum {
193 
194 
198 typedef enum {
203 
204 
208 typedef enum {
212  // end addtogroup ThorVGCapi_Shape
214 
215 
224 typedef struct
225 {
226  float offset;
227  uint8_t r;
228  uint8_t g;
229  uint8_t b;
230  uint8_t a;
232  // end addtogroup ThorVGCapi_Gradient
234 
235 
239 typedef struct
240 {
241  float x, y;
242 } Tvg_Point;
243 
244 
252 typedef struct
253 {
254  float e11, e12, e13;
255  float e21, e22, e23;
256  float e31, e32, e33;
257 } Tvg_Matrix;
258 
259 
267 /************************************************************************/
268 /* Engine API */
269 /************************************************************************/
298 TVG_API Tvg_Result tvg_engine_init(Tvg_Engine engine_method, unsigned threads);
299 
300 
326 TVG_API Tvg_Result tvg_engine_term(Tvg_Engine engine_method);
327 
328  // end defgroup ThorVGCapi_Initializer
330 
331 
353 /************************************************************************/
354 /* SwCanvas API */
355 /************************************************************************/
356 
360 typedef enum {
365 
366 
370 typedef enum {
374 
375 
401 
402 
428 TVG_API Tvg_Result tvg_swcanvas_set_target(Tvg_Canvas* canvas, uint32_t* buffer, uint32_t stride, uint32_t w, uint32_t h, Tvg_Colorspace cs);
429 
430 
456  // end defgroup ThorVGCapi_SwCanvas
458 
459 
460 /************************************************************************/
461 /* Common Canvas API */
462 /************************************************************************/
525 
526 
546 
547 
578 TVG_DEPRECATED TVG_API Tvg_Result tvg_canvas_reserve(Tvg_Canvas* canvas, uint32_t n);
579 
580 
598 TVG_API Tvg_Result tvg_canvas_clear(Tvg_Canvas* canvas, bool free);
599 
600 
659 
660 
677 
678 
695 
696 
712 
713  // end defgroup ThorVGCapi_Canvas
715 
716 
724 /************************************************************************/
725 /* Paint API */
726 /************************************************************************/
758 
759 
771 TVG_API Tvg_Result tvg_paint_scale(Tvg_Paint* paint, float factor);
772 
773 
788 TVG_API Tvg_Result tvg_paint_rotate(Tvg_Paint* paint, float degree);
789 
790 
806 TVG_API Tvg_Result tvg_paint_translate(Tvg_Paint* paint, float x, float y);
807 
808 
823 
824 
838 
839 
852 TVG_API Tvg_Result tvg_paint_set_opacity(Tvg_Paint* paint, uint8_t opacity);
853 
854 
865 TVG_API Tvg_Result tvg_paint_get_opacity(const Tvg_Paint* paint, uint8_t* opacity);
866 
867 
878 
879 
897 TVG_API Tvg_Result tvg_paint_get_bounds(const Tvg_Paint* paint, float* x, float* y, float* w, float* h, bool transformed);
898 
899 
912 
913 
926 
927 
940 TVG_API Tvg_Result tvg_paint_get_identifier(const Tvg_Paint* paint, Tvg_Identifier* identifier); // end defgroup ThorVGCapi_Paint
942 
943 
959 /************************************************************************/
960 /* Shape API */
961 /************************************************************************/
968 
969 
984 
985 
999 TVG_API Tvg_Result tvg_shape_move_to(Tvg_Paint* paint, float x, float y);
1000 
1001 
1017 TVG_API Tvg_Result tvg_shape_line_to(Tvg_Paint* paint, float x, float y);
1018 
1019 
1040 TVG_API Tvg_Result tvg_shape_cubic_to(Tvg_Paint* paint, float cx1, float cy1, float cx2, float cy2, float x, float y);
1041 
1042 
1057 
1058 
1086 TVG_API Tvg_Result tvg_shape_append_rect(Tvg_Paint* paint, float x, float y, float w, float h, float rx, float ry);
1087 
1088 
1108 TVG_API Tvg_Result tvg_shape_append_circle(Tvg_Paint* paint, float cx, float cy, float rx, float ry);
1109 
1110 
1131 TVG_API Tvg_Result tvg_shape_append_arc(Tvg_Paint* paint, float cx, float cy, float radius, float startAngle, float sweep, uint8_t pie);
1132 
1133 
1151 TVG_API Tvg_Result tvg_shape_append_path(Tvg_Paint* paint, const Tvg_Path_Command* cmds, uint32_t cmdCnt, const Tvg_Point* pts, uint32_t ptsCnt);
1152 
1153 
1177 TVG_API Tvg_Result tvg_shape_get_path_coords(const Tvg_Paint* paint, const Tvg_Point** pts, uint32_t* cnt);
1178 
1179 
1203 TVG_API Tvg_Result tvg_shape_get_path_commands(const Tvg_Paint* paint, const Tvg_Path_Command** cmds, uint32_t* cnt);
1204 
1205 
1217 TVG_API Tvg_Result tvg_shape_set_stroke_width(Tvg_Paint* paint, float width);
1218 
1219 
1230 TVG_API Tvg_Result tvg_shape_get_stroke_width(const Tvg_Paint* paint, float* width);
1231 
1232 
1249 TVG_API Tvg_Result tvg_shape_set_stroke_color(Tvg_Paint* paint, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
1250 
1251 
1266 TVG_API Tvg_Result tvg_shape_get_stroke_color(const Tvg_Paint* paint, uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a);
1267 
1268 
1284 
1285 
1301 
1302 
1316 
1317 
1339 TVG_API Tvg_Result tvg_shape_set_stroke_dash(Tvg_Paint* paint, const float* dashPattern, uint32_t cnt);
1340 
1341 
1355 TVG_API Tvg_Result tvg_shape_get_stroke_dash(const Tvg_Paint* paint, const float** dashPattern, uint32_t* cnt);
1356 
1357 
1372 
1373 
1385 
1386 
1399 
1400 
1412 
1413 
1426 TVG_API Tvg_Result tvg_shape_set_stroke_miterlimit(Tvg_Paint* paint, float miterlimit);
1427 
1428 
1439 TVG_API Tvg_Result tvg_shape_get_stroke_miterlimit(const Tvg_Paint* paint, float* miterlimit);
1440 
1441 
1460 TVG_API Tvg_Result tvg_shape_set_fill_color(Tvg_Paint* paint, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
1461 
1462 
1476 TVG_API Tvg_Result tvg_shape_get_fill_color(const Tvg_Paint* paint, uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a);
1477 
1478 
1490 
1491 
1503 
1504 
1518 TVG_API Tvg_Result tvg_shape_set_paint_order(Tvg_Paint* paint, bool strokeFirst);
1519 
1520 
1552 
1553 
1585 
1586 
1600 
1601  // end defgroup ThorVGCapi_Shape
1603 
1604 
1616 /************************************************************************/
1617 /* Gradient API */
1618 /************************************************************************/
1639 
1640 
1661 
1662 
1682 TVG_API Tvg_Result tvg_linear_gradient_set(Tvg_Gradient* grad, float x1, float y1, float x2, float y2);
1683 
1684 
1702 TVG_API Tvg_Result tvg_linear_gradient_get(Tvg_Gradient* grad, float* x1, float* y1, float* x2, float* y2);
1703 
1704 
1719 TVG_API Tvg_Result tvg_radial_gradient_set(Tvg_Gradient* grad, float cx, float cy, float radius);
1720 
1721 
1734 TVG_API Tvg_Result tvg_radial_gradient_get(Tvg_Gradient* grad, float* cx, float* cy, float* radius);
1735 
1736 
1748 TVG_API Tvg_Result tvg_gradient_set_color_stops(Tvg_Gradient* grad, const Tvg_Color_Stop* color_stop, uint32_t cnt);
1749 
1750 
1764 TVG_API Tvg_Result tvg_gradient_get_color_stops(const Tvg_Gradient* grad, const Tvg_Color_Stop** color_stop, uint32_t* cnt);
1765 
1766 
1778 
1779 
1791 
1792 
1807 
1808 
1822 
1836 
1837 
1848 
1849 
1860 
1861  // end defgroup ThorVGCapi_Gradient
1863 
1864 
1874 /************************************************************************/
1875 /* Picture API */
1876 /************************************************************************/
1883 
1884 
1897 TVG_API Tvg_Result tvg_picture_load(Tvg_Paint* paint, const char* path);
1898 
1899 
1911 TVG_API Tvg_Result tvg_picture_load_raw(Tvg_Paint* paint, uint32_t *data, uint32_t w, uint32_t h, bool copy);
1912 
1913 
1931 TVG_API Tvg_Result tvg_picture_load_data(Tvg_Paint* paint, const char *data, uint32_t size, const char *mimetype, bool copy);
1932 
1933 
1949 TVG_API Tvg_Result tvg_picture_set_size(Tvg_Paint* paint, float w, float h);
1950 
1951 
1963 TVG_API Tvg_Result tvg_picture_get_size(const Tvg_Paint* paint, float* w, float* h);
1964 
1965  // end defgroup ThorVGCapi_Picture
1967 
1968 
1979 /************************************************************************/
1980 /* Scene API */
1981 /************************************************************************/
1990 
1991 
2006 TVG_DEPRECATED TVG_API Tvg_Result tvg_scene_reserve(Tvg_Paint* scene, uint32_t size);
2007 
2008 
2027 
2028 
2044 TVG_API Tvg_Result tvg_scene_clear(Tvg_Paint* scene, bool free);
2045  // end defgroup ThorVGCapi_Scene
2047 
2048 
2059 /************************************************************************/
2060 /* Saver API */
2061 /************************************************************************/
2068 
2069 
2093 TVG_API Tvg_Result tvg_saver_save(Tvg_Saver* saver, Tvg_Paint* paint, const char* path, bool compress);
2094 
2095 
2114 
2115 
2126 
2127  // end defgroup ThorVGCapi_Saver
2129 
2130  // end defgroup ThorVG_CAPI
2132 
2133 
2134 #ifdef __cplusplus
2135 }
2136 #endif
2137 
2138 #endif //_THORVG_CAPI_H_
TVG_API 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_DEPRECATED TVG_API 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_API Tvg_Result tvg_canvas_push(Tvg_Canvas *canvas, Tvg_Paint *paint)
Inserts a drawing element into the canvas using a Tvg_Paint object.
TVG_API Tvg_Result tvg_canvas_clear(Tvg_Canvas *canvas, bool free)
Sets the total number of the paints pushed into the canvas to be zero. Tvg_Paint objects stored in th...
TVG_API Tvg_Result tvg_canvas_sync(Tvg_Canvas *canvas)
Guarantees that the drawing process is finished.
TVG_API 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_API Tvg_Result tvg_canvas_update(Tvg_Canvas *canvas)
Updates all paints in a canvas.
TVG_API Tvg_Result tvg_canvas_draw(Tvg_Canvas *canvas)
Requests the canvas to draw the Tvg_Paint objects.
TVG_API Tvg_Gradient * tvg_gradient_duplicate(Tvg_Gradient *grad)
Duplicates the given Tvg_Gradient object.
TVG_API Tvg_Result tvg_gradient_get_identifier(const Tvg_Gradient *grad, Tvg_Identifier *identifier)
Gets the unique id value of the gradient instance indicating the instance type.
TVG_API Tvg_Gradient * tvg_linear_gradient_new()
Creates a new linear gradient object.
TVG_API Tvg_Result tvg_gradient_set_transform(Tvg_Gradient *grad, const Tvg_Matrix *m)
Sets the matrix of the affine transformation for the gradient object.
TVG_API Tvg_Result tvg_linear_gradient_set(Tvg_Gradient *grad, float x1, float y1, float x2, float y2)
Sets the linear gradient bounds.
TVG_API Tvg_Result tvg_gradient_get_spread(const Tvg_Gradient *grad, Tvg_Stroke_Fill *spread)
Gets the FillSpread value of the gradient object.
TVG_API Tvg_Gradient * tvg_radial_gradient_new()
Creates a new radial gradient object.
TVG_API Tvg_Result tvg_gradient_del(Tvg_Gradient *grad)
Deletes the given gradient object.
TVG_API Tvg_Result tvg_gradient_get_color_stops(const 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_API 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_API 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_API Tvg_Result tvg_linear_gradient_get(Tvg_Gradient *grad, float *x1, float *y1, float *x2, float *y2)
Gets the linear gradient bounds.
TVG_API 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_API Tvg_Result tvg_gradient_get_transform(const Tvg_Gradient *grad, Tvg_Matrix *m)
Gets the matrix of the affine transformation of the gradient object.
TVG_API Tvg_Result tvg_radial_gradient_set(Tvg_Gradient *grad, float cx, float cy, float radius)
Sets the radial gradient bounds.
TVG_API Tvg_Result tvg_engine_init(Tvg_Engine engine_method, unsigned threads)
Initializes TVG engines.
Tvg_Engine
Enumeration specifying the engine type used for the graphics backend. For multiple backends bitwise o...
Definition: thorvg_capi.h:105
TVG_API Tvg_Result tvg_engine_term(Tvg_Engine engine_method)
Terminates TVG engines.
@ TVG_ENGINE_GL
OpenGL rasterizer.
Definition: thorvg_capi.h:107
@ TVG_ENGINE_SW
CPU rasterizer.
Definition: thorvg_capi.h:106
TVG_API Tvg_Result tvg_paint_get_bounds(const Tvg_Paint *paint, float *x, float *y, float *w, float *h, bool transformed)
Gets the axis-aligned bounding box of the Tvg_Paint object.
TVG_API Tvg_Result tvg_paint_translate(Tvg_Paint *paint, float x, float y)
Moves the given Tvg_Paint in a two-dimensional space.
Tvg_Composite_Method
Enumeration indicating the method used in the composition of two objects - the target and the source.
Definition: thorvg_capi.h:130
TVG_API Tvg_Result tvg_paint_set_transform(Tvg_Paint *paint, const Tvg_Matrix *m)
Transforms the given Tvg_Paint using the augmented transformation matrix.
TVG_API 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_API Tvg_Result tvg_paint_get_composite_method(const Tvg_Paint *paint, const Tvg_Paint **target, Tvg_Composite_Method *method)
Gets the composition target object and the composition method.
TVG_API Tvg_Result tvg_paint_del(Tvg_Paint *paint)
Releases the given Tvg_Paint object.
TVG_API Tvg_Result tvg_paint_get_opacity(const Tvg_Paint *paint, uint8_t *opacity)
Gets the opacity of the given Tvg_Paint.
TVG_API Tvg_Result tvg_paint_set_opacity(Tvg_Paint *paint, uint8_t opacity)
Sets the opacity of the given Tvg_Paint.
TVG_API Tvg_Paint * tvg_paint_duplicate(Tvg_Paint *paint)
Duplicates the given Tvg_Paint object.
TVG_API Tvg_Result tvg_paint_get_identifier(const Tvg_Paint *paint, Tvg_Identifier *identifier)
Gets the unique id value of the paint instance indicating the instance type.
Tvg_Identifier
Enumeration indicating the ThorVG class type.
Definition: thorvg_capi.h:146
TVG_API Tvg_Result tvg_paint_rotate(Tvg_Paint *paint, float degree)
Rotates the given Tvg_Paint by the given angle.
TVG_API Tvg_Result tvg_paint_get_transform(Tvg_Paint *paint, Tvg_Matrix *m)
Gets the matrix of the affine transformation of the given Tvg_Paint object.
TVG_API Tvg_Result tvg_paint_scale(Tvg_Paint *paint, float factor)
Scales the given Tvg_Paint object by the given factor.
@ TVG_COMPOSITE_METHOD_LUMA_MASK
The source pixels are converted to grayscale (luma value) and alpha blended with the target....
Definition: thorvg_capi.h:135
@ 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:132
@ TVG_COMPOSITE_METHOD_NONE
No composition is applied.
Definition: thorvg_capi.h:131
@ 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:133
@ TVG_COMPOSITE_METHOD_INVERSE_ALPHA_MASK
The pixels of the source and the complement to the target's pixels are alpha blended....
Definition: thorvg_capi.h:134
@ TVG_IDENTIFIER_SHAPE
A shape type paint.
Definition: thorvg_capi.h:148
@ TVG_IDENTIFIER_PICTURE
A picture type paint.
Definition: thorvg_capi.h:150
@ TVG_IDENTIFIER_UNDEF
Undefined type.
Definition: thorvg_capi.h:147
@ TVG_IDENTIFIER_RADIAL_GRAD
A radial gradient type.
Definition: thorvg_capi.h:152
@ TVG_IDENTIFIER_SCENE
A scene type paint.
Definition: thorvg_capi.h:149
@ TVG_IDENTIFIER_LINEAR_GRAD
A linear gradient type.
Definition: thorvg_capi.h:151
TVG_API Tvg_Result tvg_picture_load_data(Tvg_Paint *paint, const char *data, uint32_t size, const char *mimetype, bool copy)
Loads a picture data from a memory block of a given size.
TVG_API Tvg_Result tvg_picture_load(Tvg_Paint *paint, const char *path)
Loads a picture data directly from a file.
TVG_API Tvg_Result tvg_picture_get_size(const Tvg_Paint *paint, float *w, float *h)
Gets the size of the loaded picture.
TVG_API 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.
TVG_API Tvg_Paint * tvg_picture_new()
Creates a new picture object.
TVG_API Tvg_Result tvg_picture_set_size(Tvg_Paint *paint, float w, float h)
Resizes the picture content to the given width and height.
TVG_API Tvg_Result tvg_saver_sync(Tvg_Saver *saver)
Guarantees that the saving task is finished.
TVG_API Tvg_Result tvg_saver_save(Tvg_Saver *saver, Tvg_Paint *paint, const char *path, bool compress)
Exports the given paint data to the given path.
TVG_API Tvg_Result tvg_saver_del(Tvg_Saver *saver)
Deletes the given Tvg_Saver object.
TVG_API Tvg_Saver * tvg_saver_new()
Creates a new Tvg_Saver object.
TVG_DEPRECATED TVG_API 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_API Tvg_Paint * tvg_scene_new()
Creates a new scene object.
TVG_API Tvg_Result tvg_scene_clear(Tvg_Paint *scene, bool free)
Clears a Tvg_Scene objects from pushed paints.
TVG_API Tvg_Result tvg_scene_push(Tvg_Paint *scene, Tvg_Paint *paint)
Passes drawing elements to the scene using Tvg_Paint objects.
TVG_API Tvg_Result tvg_shape_set_stroke_miterlimit(Tvg_Paint *paint, float miterlimit)
Sets the stroke miterlimit. (BETA_API)
TVG_API Tvg_Result tvg_shape_set_fill_rule(Tvg_Paint *paint, Tvg_Fill_Rule rule)
Sets the shape's fill rule.
TVG_API 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_API 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_Path_Command
Enumeration specifying the values of the path commands accepted by TVG.
Definition: thorvg_capi.h:167
TVG_API 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_API 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_API 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.
TVG_API Tvg_Result tvg_shape_get_stroke_width(const Tvg_Paint *paint, float *width)
Gets the shape's stroke width.
TVG_API 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.
TVG_API Tvg_Result tvg_shape_get_gradient(const Tvg_Paint *paint, Tvg_Gradient **grad)
Gets the gradient fill of the shape.
TVG_API 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_Stroke_Cap
Enumeration determining the ending type of a stroke in the open sub-paths.
Definition: thorvg_capi.h:178
TVG_API 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_API Tvg_Result tvg_shape_set_stroke_dash(Tvg_Paint *paint, const float *dashPattern, uint32_t cnt)
Sets the shape's stroke dash pattern.
TVG_API 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_API 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_API Tvg_Result tvg_shape_get_stroke_miterlimit(const Tvg_Paint *paint, float *miterlimit)
The function gets the stroke miterlimit. (BETA_API)
TVG_API Tvg_Result tvg_shape_set_stroke_cap(Tvg_Paint *paint, Tvg_Stroke_Cap cap)
Sets the cap style used for stroking the path.
TVG_API Tvg_Result tvg_shape_set_stroke_join(Tvg_Paint *paint, Tvg_Stroke_Join join)
Sets the join style for stroked path segments.
TVG_API Tvg_Result tvg_shape_append_circle(Tvg_Paint *paint, float cx, float cy, float rx, float ry)
Appends an ellipse to the path.
TVG_API 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.
TVG_API 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_Stroke_Fill
Enumeration specifying how to fill the area outside the gradient bounds.
Definition: thorvg_capi.h:198
TVG_API 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_API 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_API Tvg_Paint * tvg_shape_new()
Creates a new shape object.
TVG_API Tvg_Result tvg_shape_get_fill_rule(const Tvg_Paint *paint, Tvg_Fill_Rule *rule)
Gets the shape's fill rule.
TVG_API Tvg_Result tvg_shape_set_paint_order(Tvg_Paint *paint, bool strokeFirst)
Sets the rendering order of the stroke and the fill.
TVG_API 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_API 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_API Tvg_Result tvg_shape_get_stroke_gradient(const Tvg_Paint *paint, Tvg_Gradient **grad)
Gets the gradient fill of the shape's stroke.
TVG_API 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.
TVG_API Tvg_Result tvg_shape_reset(Tvg_Paint *paint)
Resets the shape path properties.
TVG_API Tvg_Result tvg_shape_move_to(Tvg_Paint *paint, float x, float y)
Sets the initial point of the sub-path.
TVG_API 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_API 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
Enumeration specifying how to fill the area outside the gradient bounds.
Definition: thorvg_capi.h:188
TVG_API 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_Fill_Rule
Enumeration specifying the algorithm used to establish which parts of the shape are treated as the in...
Definition: thorvg_capi.h:208
@ 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:171
@ 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:168
@ 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:169
@ 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:170
@ 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:180
@ 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:179
@ 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:181
@ TVG_STROKE_FILL_REFLECT
The gradient pattern is reflected outside the gradient area until the expected region is filled.
Definition: thorvg_capi.h:200
@ TVG_STROKE_FILL_PAD
The remaining area is filled with the closest stop color.
Definition: thorvg_capi.h:199
@ TVG_STROKE_FILL_REPEAT
The gradient pattern is repeated continuously beyond the gradient area until the expected region is f...
Definition: thorvg_capi.h:201
@ 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:189
@ 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:191
@ 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:190
@ 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:210
@ 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:209
TVG_API Tvg_Canvas * tvg_swcanvas_create()
Creates a Canvas object.
TVG_API Tvg_Result tvg_swcanvas_set_target(Tvg_Canvas *canvas, uint32_t *buffer, uint32_t stride, uint32_t w, uint32_t h, Tvg_Colorspace cs)
Sets the buffer used in the rasterization process and defines the used colorspace.
TVG_API Tvg_Result tvg_swcanvas_set_mempool(Tvg_Canvas *canvas, Tvg_Mempool_Policy policy)
Sets the software engine memory pool behavior policy.
Tvg_Colorspace
Enumeration specifying the methods of combining the 8-bit color channels into 32-bit color.
Definition: thorvg_capi.h:370
Tvg_Mempool_Policy
Enumeration specifying the methods of Memory Pool behavior policy.
Definition: thorvg_capi.h:360
@ TVG_COLORSPACE_ARGB8888
The 8-bit color channels are combined into 32-bit color in the order: alpha, red, green,...
Definition: thorvg_capi.h:372
@ TVG_COLORSPACE_ABGR8888
The 8-bit color channels are combined into 32-bit color in the order: alpha, blue,...
Definition: thorvg_capi.h:371
@ TVG_MEMPOOL_POLICY_INDIVIDUAL
Allocate designated memory pool that is used only by the current canvas instance.
Definition: thorvg_capi.h:363
@ TVG_MEMPOOL_POLICY_DEFAULT
Default behavior that ThorVG is designed to.
Definition: thorvg_capi.h:361
@ TVG_MEMPOOL_POLICY_SHAREABLE
Memory Pool is shared among canvases.
Definition: thorvg_capi.h:362
struct _Tvg_Canvas Tvg_Canvas
A structure responsible for managing and drawing graphical elements.
Definition: thorvg_capi.h:77
struct _Tvg_Paint Tvg_Paint
A structure representing a graphical element.
Definition: thorvg_capi.h:85
struct _Tvg_Saver Tvg_Saver
A structure representing an object that enables to save a Tvg_Paint object into a file.
Definition: thorvg_capi.h:97
Tvg_Result
Enumeration specifying the result from the APIs.
Definition: thorvg_capi.h:114
struct _Tvg_Gradient Tvg_Gradient
A structure representing a gradient fill of a Tvg_Paint object.
Definition: thorvg_capi.h:91
@ TVG_RESULT_UNKNOWN
The value returned in all other cases.
Definition: thorvg_capi.h:121
@ 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:116
@ TVG_RESULT_NOT_SUPPORTED
The value returned in case of choosing unsupported options.
Definition: thorvg_capi.h:120
@ TVG_RESULT_FAILED_ALLOCATION
The value returned in case of unsuccessful memory allocation.
Definition: thorvg_capi.h:118
@ 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:117
@ 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:119
@ TVG_RESULT_SUCCESS
The value returned in case of a correct request execution.
Definition: thorvg_capi.h:115
A data structure storing the information about the color and its relative position inside the gradien...
Definition: thorvg_capi.h:225
uint8_t g
Definition: thorvg_capi.h:228
float offset
Definition: thorvg_capi.h:226
uint8_t b
Definition: thorvg_capi.h:229
uint8_t r
Definition: thorvg_capi.h:227
uint8_t a
Definition: thorvg_capi.h:230
A data structure representing a three-dimensional matrix.
Definition: thorvg_capi.h:253
A data structure representing a point in two-dimensional space.
Definition: thorvg_capi.h:240