ThorVG  v0.11
thorvg.h
1 
15 #ifndef _THORVG_H_
16 #define _THORVG_H_
17 
18 #include <functional>
19 #include <memory>
20 #include <string>
21 #include <list>
22 
23 #ifdef TVG_API
24  #undef TVG_API
25 #endif
26 
27 #ifndef TVG_STATIC
28  #ifdef _WIN32
29  #if TVG_BUILD
30  #define TVG_API __declspec(dllexport)
31  #else
32  #define TVG_API __declspec(dllimport)
33  #endif
34  #elif (defined(__SUNPRO_C) || defined(__SUNPRO_CC))
35  #define TVG_API __global
36  #else
37  #if (defined(__GNUC__) && __GNUC__ >= 4) || defined(__INTEL_COMPILER)
38  #define TVG_API __attribute__ ((visibility("default")))
39  #else
40  #define TVG_API
41  #endif
42  #endif
43 #else
44  #define TVG_API
45 #endif
46 
47 #ifdef TVG_DEPRECATED
48  #undef TVG_DEPRECATED
49 #endif
50 
51 #ifdef _WIN32
52  #define TVG_DEPRECATED __declspec(deprecated)
53 #elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
54  #define TVG_DEPRECATED __attribute__ ((__deprecated__))
55 #else
56  #define TVG_DEPRECATED
57 #endif
58 
59 #define _TVG_DECLARE_PRIVATE(A) \
60  struct Impl; \
61  Impl* pImpl; \
62 protected: \
63  A(const A&) = delete; \
64  const A& operator=(const A&) = delete; \
65  A()
66 
67 #define _TVG_DISABLE_CTOR(A) \
68  A() = delete; \
69  ~A() = delete
70 
71 #define _TVG_DECLARE_ACCESSOR(A) \
72  friend A
73 
74 namespace tvg
75 {
76 
77 class RenderMethod;
78 class Animation;
79 
90 enum class Result
91 {
92  Success = 0,
97  NonSupport,
98  Unknown
99 };
100 
101 
108 enum class PathCommand
109 {
110  Close = 0,
111  MoveTo,
112  LineTo,
113  CubicTo
114 };
115 
116 
120 enum class StrokeCap
121 {
122  Square = 0,
123  Round,
124  Butt
125 };
126 
127 
131 enum class StrokeJoin
132 {
133  Bevel = 0,
134  Round,
135  Miter
136 };
137 
138 
142 enum class FillSpread
143 {
144  Pad = 0,
145  Reflect,
146  Repeat
147 };
148 
149 
153 enum class FillRule
154 {
155  Winding = 0,
156  EvenOdd
157 };
158 
159 
167 enum class CompositeMethod
168 {
169  None = 0,
170  ClipPath,
171  AlphaMask,
172  InvAlphaMask,
173  LumaMask,
174  InvLumaMask,
175  AddMask,
176  SubtractMask,
177  IntersectMask,
179 };
180 
181 
191 enum class BlendMethod : uint8_t
192 {
193  Normal = 0,
194  Add,
195  Screen,
196  Multiply,
197  Overlay,
198  Difference,
199  Exclusion,
200  SrcOver,
201  Darken,
202  Lighten,
203  ColorDodge,
204  ColorBurn,
205  HardLight,
206  SoftLight
207 };
208 
209 
213 enum class CanvasEngine
214 {
215  Sw = (1 << 1),
216  Gl = (1 << 2)
217 };
218 
219 
223 struct Point
224 {
225  float x, y;
226 };
227 
228 
236 struct Matrix
237 {
238  float e11, e12, e13;
239  float e21, e22, e23;
240  float e31, e32, e33;
241 };
242 
243 
252 struct Vertex
253 {
254  Point pt;
255  Point uv;
256 };
257 
258 
266 struct Polygon
267 {
268  Vertex vertex[3];
269 };
270 
271 
281 class TVG_API Paint
282 {
283 public:
284  virtual ~Paint();
285 
296  Result rotate(float degree) noexcept;
297 
305  Result scale(float factor) noexcept;
306 
318  Result translate(float x, float y) noexcept;
319 
329  Result transform(const Matrix& m) noexcept;
330 
341  Matrix transform() noexcept;
342 
353  Result opacity(uint8_t o) noexcept;
354 
363  Result composite(std::unique_ptr<Paint> target, CompositeMethod method) noexcept;
364 
378  Result blend(BlendMethod method) const noexcept;
379 
394  TVG_DEPRECATED Result bounds(float* x, float* y, float* w, float* h) const noexcept;
395 
411  Result bounds(float* x, float* y, float* w, float* h, bool transformed) const noexcept;
412 
420  Paint* duplicate() const noexcept;
421 
427  uint8_t opacity() const noexcept;
428 
438  CompositeMethod composite(const Paint** target) const noexcept;
439 
447  BlendMethod blend() const noexcept;
448 
456  uint32_t identifier() const noexcept;
457 
458  _TVG_DECLARE_PRIVATE(Paint);
459 };
460 
461 
473 class TVG_API Fill
474 {
475 public:
479  struct ColorStop
480  {
481  float offset;
482  uint8_t r;
483  uint8_t g;
484  uint8_t b;
485  uint8_t a;
486  };
487 
488  virtual ~Fill();
489 
498  Result colorStops(const ColorStop* colorStops, uint32_t cnt) noexcept;
499 
507  Result spread(FillSpread s) noexcept;
508 
518  Result transform(const Matrix& m) noexcept;
519 
527  uint32_t colorStops(const ColorStop** colorStops) const noexcept;
528 
534  FillSpread spread() const noexcept;
535 
543  Matrix transform() const noexcept;
544 
552  Fill* duplicate() const noexcept;
553 
561  uint32_t identifier() const noexcept;
562 
563  _TVG_DECLARE_PRIVATE(Fill);
564 };
565 
566 
577 class TVG_API Canvas
578 {
579 public:
580  Canvas(RenderMethod*);
581  virtual ~Canvas();
582 
593  TVG_DEPRECATED Result reserve(uint32_t n) noexcept;
594 
605  std::list<Paint*>& paints() noexcept;
606 
623  virtual Result push(std::unique_ptr<Paint> paint) noexcept;
624 
639  virtual Result clear(bool free = true) noexcept;
640 
653  virtual Result update(Paint* paint = nullptr) noexcept;
654 
663  virtual Result draw() noexcept;
664 
674  virtual Result sync() noexcept;
675 
676  _TVG_DECLARE_PRIVATE(Canvas);
677 };
678 
679 
688 class TVG_API LinearGradient final : public Fill
689 {
690 public:
691  ~LinearGradient();
692 
709  Result linear(float x1, float y1, float x2, float y2) noexcept;
710 
725  Result linear(float* x1, float* y1, float* x2, float* y2) const noexcept;
726 
732  static std::unique_ptr<LinearGradient> gen() noexcept;
733 
741  static uint32_t identifier() noexcept;
742 
743  _TVG_DECLARE_PRIVATE(LinearGradient);
744 };
745 
746 
753 class TVG_API RadialGradient final : public Fill
754 {
755 public:
756  ~RadialGradient();
757 
769  Result radial(float cx, float cy, float radius) noexcept;
770 
782  Result radial(float* cx, float* cy, float* radius) const noexcept;
783 
789  static std::unique_ptr<RadialGradient> gen() noexcept;
790 
798  static uint32_t identifier() noexcept;
799 
800  _TVG_DECLARE_PRIVATE(RadialGradient);
801 };
802 
803 
816 class TVG_API Shape final : public Paint
817 {
818 public:
819  ~Shape();
820 
830  Result reset() noexcept;
831 
842  Result moveTo(float x, float y) noexcept;
843 
856  Result lineTo(float x, float y) noexcept;
857 
875  Result cubicTo(float cx1, float cy1, float cx2, float cy2, float x, float y) noexcept;
876 
886  Result close() noexcept;
887 
912  Result appendRect(float x, float y, float w, float h, float rx = 0, float ry = 0) noexcept;
913 
930  Result appendCircle(float cx, float cy, float rx, float ry) noexcept;
931 
949  Result appendArc(float cx, float cy, float radius, float startAngle, float sweep, bool pie) noexcept;
950 
967  Result appendPath(const PathCommand* cmds, uint32_t cmdCnt, const Point* pts, uint32_t ptsCnt) noexcept;
968 
976  Result stroke(float width) noexcept;
977 
988  Result stroke(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255) noexcept;
989 
999  Result stroke(std::unique_ptr<Fill> f) noexcept;
1000 
1014  Result stroke(const float* dashPattern, uint32_t cnt) noexcept;
1015 
1023  Result stroke(StrokeCap cap) noexcept;
1024 
1034  Result stroke(StrokeJoin join) noexcept;
1035 
1036 
1046  Result strokeMiterlimit(float miterlimit) noexcept;
1047 
1063  Result fill(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255) noexcept;
1064 
1076  Result fill(std::unique_ptr<Fill> f) noexcept;
1077 
1085  Result fill(FillRule r) noexcept;
1086 
1087 
1097  Result order(bool strokeFirst) noexcept;
1098 
1099 
1107  uint32_t pathCommands(const PathCommand** cmds) const noexcept;
1108 
1116  uint32_t pathCoords(const Point** pts) const noexcept;
1117 
1123  const Fill* fill() const noexcept;
1124 
1135  Result fillColor(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a = nullptr) const noexcept;
1136 
1142  FillRule fillRule() const noexcept;
1143 
1149  float strokeWidth() const noexcept;
1150 
1161  Result strokeColor(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a = nullptr) const noexcept;
1162 
1168  const Fill* strokeFill() const noexcept;
1169 
1177  uint32_t strokeDash(const float** dashPattern) const noexcept;
1178 
1184  StrokeCap strokeCap() const noexcept;
1185 
1191  StrokeJoin strokeJoin() const noexcept;
1192 
1200  float strokeMiterlimit() const noexcept;
1201 
1207  static std::unique_ptr<Shape> gen() noexcept;
1208 
1216  static uint32_t identifier() noexcept;
1217 
1218  _TVG_DECLARE_PRIVATE(Shape);
1219 };
1220 
1221 
1231 class TVG_API Picture final : public Paint
1232 {
1233 public:
1234  ~Picture();
1235 
1249  Result load(const std::string& path) noexcept;
1250 
1267  TVG_DEPRECATED Result load(const char* data, uint32_t size, bool copy = false) noexcept;
1268 
1287  Result load(const char* data, uint32_t size, const std::string& mimeType, bool copy = false) noexcept;
1288 
1300  Result size(float w, float h) noexcept;
1301 
1310  Result size(float* w, float* h) const noexcept;
1311 
1320  Result load(uint32_t* data, uint32_t w, uint32_t h, bool copy) noexcept;
1321 
1344  Result mesh(const Polygon* triangles, uint32_t triangleCnt) noexcept;
1345 
1358  uint32_t mesh(const Polygon** triangles) const noexcept;
1359 
1365  static std::unique_ptr<Picture> gen() noexcept;
1366 
1374  static uint32_t identifier() noexcept;
1375 
1376  _TVG_DECLARE_ACCESSOR(Animation);
1377  _TVG_DECLARE_PRIVATE(Picture);
1378 };
1379 
1380 
1392 class TVG_API Scene final : public Paint
1393 {
1394 public:
1395  ~Scene();
1396 
1411  Result push(std::unique_ptr<Paint> paint) noexcept;
1412 
1423  TVG_DEPRECATED Result reserve(uint32_t size) noexcept;
1424 
1437  std::list<Paint*>& paints() noexcept;
1438 
1451  Result clear(bool free = true) noexcept;
1452 
1458  static std::unique_ptr<Scene> gen() noexcept;
1459 
1467  static uint32_t identifier() noexcept;
1468 
1469  _TVG_DECLARE_PRIVATE(Scene);
1470 };
1471 
1472 
1478 class TVG_API SwCanvas final : public Canvas
1479 {
1480 public:
1481  ~SwCanvas();
1482 
1487  {
1488  ABGR8888 = 0,
1492  };
1493 
1499  {
1500  Default = 0,
1502  Individual
1503  };
1504 
1523  Result target(uint32_t* buffer, uint32_t stride, uint32_t w, uint32_t h, Colorspace cs) noexcept;
1524 
1548  Result mempool(MempoolPolicy policy) noexcept;
1549 
1554  static std::unique_ptr<SwCanvas> gen() noexcept;
1555 
1556  _TVG_DECLARE_PRIVATE(SwCanvas);
1557 };
1558 
1559 
1569 class TVG_API GlCanvas final : public Canvas
1570 {
1571 public:
1572  ~GlCanvas();
1573 
1581  Result target(uint32_t* buffer, uint32_t stride, uint32_t w, uint32_t h) noexcept;
1582 
1590  static std::unique_ptr<GlCanvas> gen() noexcept;
1591 
1592  _TVG_DECLARE_PRIVATE(GlCanvas);
1593 };
1594 
1595 
1601 class TVG_API Initializer final
1602 {
1603 public:
1624  static Result init(CanvasEngine engine, uint32_t threads) noexcept;
1625 
1640  static Result term(CanvasEngine engine) noexcept;
1641 
1642  _TVG_DISABLE_CTOR(Initializer);
1643 };
1644 
1645 
1656 class TVG_API Animation
1657 {
1658 public:
1659  ~Animation();
1660 
1674  Result frame(uint32_t no) noexcept;
1675 
1689  Picture* picture() const noexcept;
1690 
1703  uint32_t curFrame() const noexcept;
1704 
1715  uint32_t totalFrame() const noexcept;
1716 
1726  float duration() const noexcept;
1727 
1735  static std::unique_ptr<Animation> gen() noexcept;
1736 
1737  _TVG_DECLARE_PRIVATE(Animation);
1738 };
1739 
1740 
1758 class TVG_API Saver final
1759 {
1760 public:
1761  ~Saver();
1762 
1785  Result save(std::unique_ptr<Paint> paint, const std::string& path, bool compress = true) noexcept;
1786 
1802  Result sync() noexcept;
1803 
1811  static std::unique_ptr<Saver> gen() noexcept;
1812 
1813  _TVG_DECLARE_PRIVATE(Saver);
1814 };
1815 
1816 
1828 class TVG_API Accessor final
1829 {
1830 public:
1831  ~Accessor();
1832 
1843  std::unique_ptr<Picture> set(std::unique_ptr<Picture> picture, std::function<bool(const Paint* paint)> func) noexcept;
1844 
1850  static std::unique_ptr<Accessor> gen() noexcept;
1851 
1852  _TVG_DECLARE_PRIVATE(Accessor);
1853 };
1854 
1855 
1860 template<typename T>
1861 std::unique_ptr<T> cast(Paint* paint)
1862 {
1863  return std::unique_ptr<T>(static_cast<T*>(paint));
1864 }
1865 
1866 
1871 template<typename T>
1872 std::unique_ptr<T> cast(Fill* fill)
1873 {
1874  return std::unique_ptr<T>(static_cast<T*>(fill));
1875 }
1876 
1877 
1880 } //namespace
1881 
1882 #endif //_THORVG_H_
The Accessor is a utility class to debug the Scene structure by traversing the scene-tree.
Definition: thorvg.h:1829
std::unique_ptr< Picture > set(std::unique_ptr< Picture > picture, std::function< bool(const Paint *paint)> func) noexcept
Set the access function for traversing the Picture scene tree nodes.
static std::unique_ptr< Accessor > gen() noexcept
Creates a new Accessor object.
The Animation class enables manipulation of animatable images.
Definition: thorvg.h:1657
Picture * picture() const noexcept
Retrieves a picture instance associated with this animation instance.
Result frame(uint32_t no) noexcept
Specifies the current frame in the animation.
An abstract class for drawing graphical elements.
Definition: thorvg.h:578
TVG_DEPRECATED Result reserve(uint32_t n) noexcept
Sets the size of the container, where all the paints pushed into the Canvas are stored.
std::list< Paint * > & paints() noexcept
Returns the list of the paints that currently held by the Canvas.
An abstract class representing the gradient fill of the Shape object.
Definition: thorvg.h:474
FillSpread spread() const noexcept
Gets the FillSpread value of the fill.
Result colorStops(const ColorStop *colorStops, uint32_t cnt) noexcept
Sets the parameters of the colors of the gradient and their position.
Result transform(const Matrix &m) noexcept
Sets the matrix of the affine transformation for the gradient fill.
uint32_t colorStops(const ColorStop **colorStops) const noexcept
Gets the parameters of the colors of the gradient, their position and number.
Result spread(FillSpread s) noexcept
Sets the FillSpread value, which specifies how to fill the area outside the gradient bounds.
A class for the rendering graphic elements with a GL raster engine.
Definition: thorvg.h:1570
Result target(uint32_t *buffer, uint32_t stride, uint32_t w, uint32_t h) noexcept
Sets the target buffer for the rasterization.
static std::unique_ptr< GlCanvas > gen() noexcept
Creates a new GlCanvas object.
A class that enables initialization and termination of the TVG engines.
Definition: thorvg.h:1602
static Result term(CanvasEngine engine) noexcept
Terminates TVG engines.
static Result init(CanvasEngine engine, uint32_t threads) noexcept
Initializes TVG engines.
A class representing the linear gradient fill of the Shape object.
Definition: thorvg.h:689
static std::unique_ptr< LinearGradient > gen() noexcept
Creates a new LinearGradient object.
Result linear(float *x1, float *y1, float *x2, float *y2) const noexcept
Gets the linear gradient bounds.
Result linear(float x1, float y1, float x2, float y2) noexcept
Sets the linear gradient bounds.
An abstract class for managing graphical elements.
Definition: thorvg.h:282
Result scale(float factor) noexcept
Sets the scale value of the object.
Result rotate(float degree) noexcept
Sets the angle by which the object is rotated.
Result transform(const Matrix &m) noexcept
Sets the matrix of the affine transformation for the object.
Matrix transform() noexcept
Gets the matrix of the affine transformation of the object.
Result translate(float x, float y) noexcept
Sets the values by which the object is moved in a two-dimensional space.
A class representing an image read in one of the supported formats: raw, svg, png,...
Definition: thorvg.h:1232
TVG_DEPRECATED Result load(const char *data, uint32_t size, bool copy=false) noexcept
Loads a picture data from a memory block of a given size.
Result load(const std::string &path) noexcept
Loads a picture data directly from a file.
A class representing the radial gradient fill of the Shape object.
Definition: thorvg.h:754
Result radial(float cx, float cy, float radius) noexcept
Sets the radial gradient bounds.
Result radial(float *cx, float *cy, float *radius) const noexcept
Gets the radial gradient bounds.
static std::unique_ptr< RadialGradient > gen() noexcept
Creates a new RadialGradient object.
A class for exporting a paint object into a specified file, from which to recover the paint data late...
Definition: thorvg.h:1759
Result save(std::unique_ptr< Paint > paint, const std::string &path, bool compress=true) noexcept
Exports the given paint data to the given path.
A class to composite children paints.
Definition: thorvg.h:1393
Result push(std::unique_ptr< Paint > paint) noexcept
Passes drawing elements to the Scene using Paint objects.
TVG_DEPRECATED Result reserve(uint32_t size) noexcept
Sets the size of the container, where all the paints pushed into the Scene are stored.
std::list< Paint * > & paints() noexcept
Returns the list of the paints that currently held by the Scene.
A class representing two-dimensional figures and their properties.
Definition: thorvg.h:817
Result reset() noexcept
Resets the properties of the shape path.
A class for the rendering graphical elements with a software raster engine.
Definition: thorvg.h:1479
Result target(uint32_t *buffer, uint32_t stride, uint32_t w, uint32_t h, Colorspace cs) noexcept
Sets the target buffer for the rasterization.
Result mempool(MempoolPolicy policy) noexcept
Set sw engine memory pool behavior policy.
Colorspace
Enumeration specifying the methods of combining the 8-bit color channels into 32-bit color.
Definition: thorvg.h:1487
@ ARGB8888S
@BETA_API The channels are joined in the order: alpha, red, green, blue. Colors are un-alpha-premulti...
Definition: thorvg.h:1491
@ ABGR8888S
@BETA_API The channels are joined in the order: alpha, blue, green, red. Colors are un-alpha-premulti...
Definition: thorvg.h:1490
@ ARGB8888
The channels are joined in the order: alpha, red, green, blue. Colors are alpha-premultiplied....
Definition: thorvg.h:1489
MempoolPolicy
Enumeration specifying the methods of Memory Pool behavior policy.
Definition: thorvg.h:1499
@ Shareable
Memory Pool is shared among the SwCanvases.
Definition: thorvg.h:1501
static std::unique_ptr< SwCanvas > gen() noexcept
Creates a new SwCanvas object.
FillSpread
Enumeration specifying how to fill the area outside the gradient bounds.
Definition: thorvg.h:143
std::unique_ptr< T > cast(Fill *fill)
The cast() function is a utility function used to cast a 'Fill' to type 'T'.
Definition: thorvg.h:1872
Result
Enumeration specifying the result from the APIs.
Definition: thorvg.h:91
CanvasEngine
Enumeration specifying the engine type used for the graphics backend. For multiple backends bitwise o...
Definition: thorvg.h:214
BlendMethod
Enumeration indicates the method used for blending paint. Please refer to the respective formulas for...
Definition: thorvg.h:192
StrokeCap
Enumeration determining the ending type of a stroke in the open sub-paths.
Definition: thorvg.h:121
PathCommand
Enumeration specifying the values of the path commands accepted by TVG.
Definition: thorvg.h:109
FillRule
Enumeration specifying the algorithm used to establish which parts of the shape are treated as the in...
Definition: thorvg.h:154
CompositeMethod
Enumeration indicating the method used in the composition of two objects - the target and the source.
Definition: thorvg.h:168
StrokeJoin
Enumeration determining the style used at the corners of joined stroked path segments.
Definition: thorvg.h:132
@ Repeat
The gradient pattern is repeated continuously beyond the gradient area until the expected region is f...
@ Reflect
The gradient pattern is reflected outside the gradient area until the expected region is filled.
@ Pad
The remaining area is filled with the closest stop color.
@ InsufficientCondition
The value returned in case the request cannot be processed - e.g. asking for properties of an object,...
@ Success
The value returned in case of a correct request execution.
@ Unknown
The value returned in all other cases.
@ NonSupport
The value returned in case of choosing unsupported options.
@ FailedAllocation
The value returned in case of unsuccessful memory allocation.
@ InvalidArguments
The value returned in the event of a problem with the arguments given to the API - e....
@ MemoryCorruption
The value returned in the event of bad memory handling - e.g. failing in pointer releasing or casting...
@ Gl
OpenGL rasterizer.
@ Sw
CPU rasterizer.
@ SoftLight
The same as Overlay but with applying pure black or white does not result in pure black or white....
@ Lighten
Only has the opposite action of Darken Only. max(S, D)
@ Exclusion
The result is twice the product of the top and bottom layers, subtracted from their sum....
@ Difference
Subtracts the bottom layer from the top layer or the other way around, to always get a non-negative v...
@ Screen
The values of the pixels in the two layers are inverted, multiplied, and then inverted again....
@ Overlay
Combines Multiply and Screen blend modes. (2 * S * D) if (2 * D < Da), otherwise (Sa * Da) - 2 * (Da ...
@ Normal
Perform the alpha blending(default). S if (Sa == 255), otherwise (Sa * S) + (255 - Sa) * D.
@ SrcOver
Replace the bottom layer with the top layer.
@ ColorBurn
Divides the inverted bottom layer by the top layer, and then inverts the result. 255 - (255 - D) / S.
@ HardLight
The same as Overlay but with the color roles reversed. (2 * S * D) if (S < Sa), otherwise (Sa * Da) -...
@ Multiply
Takes the RGB channel values from 0 to 255 of each pixel in the top layer and multiples them with the...
@ Add
Simply adds pixel values of one layer with the other. (S + D)
@ ColorDodge
Divides the bottom layer by the inverted top layer. D / (255 - S)
@ Darken
Creates a pixel that retains the smallest components of the top and bottom layer pixels....
@ Butt
The stroke ends exactly at each of the two end-points of a sub-path. For zero length sub-paths no str...
@ Round
The stroke is extended in both end-points of a sub-path by a half circle, with a radius equal to the ...
@ Square
The stroke is extended in both end-points of a sub-path by a rectangle, with the width equal to the s...
@ LineTo
Draws a line from the current point to the given point and sets a new value of the current point....
@ CubicTo
Draws a cubic Bezier curve from the current point to the given point using two given control points a...
@ Close
Ends the current sub-path and connects it with its initial point. This command doesn't expect any poi...
@ MoveTo
Sets a new initial point of the sub-path and a new current point. This command expects 1 point: the s...
@ Winding
A line from the point to a location outside the shape is drawn. The intersections of the line with th...
@ EvenOdd
A line from the point to a location outside the shape is drawn and its intersections with the path se...
@ InvLumaMask
Alpha Masking using the grayscale (0.2125R + 0.7154G + 0.0721*B) of the complement to the compositing...
@ LumaMask
Alpha Masking using the grayscale (0.2125R + 0.7154G + 0.0721*B) of the compositing target's pixels.
@ InvAlphaMask
Alpha Masking using the complement to the compositing target's pixels as an alpha value.
@ ClipPath
The intersection of the source and the target is determined and only the resulting pixels from the so...
@ None
No composition is applied.
@ DifferenceMask
Calculates the absolute difference between the target color and the source color multiplied by the co...
@ AddMask
Combines the target and source objects pixels using target alpha. (T * TA) + (S * (255 - TA)) @BETA_A...
@ SubtractMask
Subtracts the source color from the target color while considering their respective target alpha....
@ AlphaMask
Alpha Masking using the compositing target's pixels as an alpha value.
@ IntersectMask
Computes the result by taking the minimum value between the target alpha and the source alpha and mul...
@ Bevel
The outer corner of the joined path segments is bevelled at the join point. The triangular region of ...
@ Round
The outer corner of the joined path segments is rounded. The circular region is centered at the join ...
@ Miter
The outer corner of the joined path segments is spiked. The spike is created by extension beyond the ...
A data structure storing the information about the color and its relative position inside the gradien...
Definition: thorvg.h:480
uint8_t g
Definition: thorvg.h:483
float offset
Definition: thorvg.h:481
uint8_t b
Definition: thorvg.h:484
uint8_t r
Definition: thorvg.h:482
uint8_t a
Definition: thorvg.h:485
A data structure representing a three-dimensional matrix.
Definition: thorvg.h:237
A data structure representing a point in two-dimensional space.
Definition: thorvg.h:224
A data structure representing a triange in a texture mesh.
Definition: thorvg.h:267
A data structure representing a texture mesh vertex.
Definition: thorvg.h:253