 |
ThorVG
v0.5
|
22 #define TVG_EXPORT __declspec(dllexport)
23 #define TVG_DEPRECATED __declspec(deprecated)
25 #define TVG_EXPORT __attribute__ ((visibility ("default")))
26 #define TVG_DEPRECATED __attribute__ ((__deprecated__))
30 #define TVG_DEPRECATED
37 #define _TVG_DECLARE_PRIVATE(A) \
41 A(const A&) = delete; \
42 const A& operator=(const A&) = delete; \
45 #define _TVG_DISABLE_CTOR(A) \
49 #define _TVG_DECLARE_ACCESSOR() \
53 friend IteratorModule; \
56 #define _TVG_DECALRE_IDENTIFIER() \
57 auto id() const { return _id; } \
213 Result rotate(
float degree) noexcept;
222 Result scale(
float factor) noexcept;
235 Result translate(
float x,
float y) noexcept;
258 Matrix transform() noexcept;
269 Result opacity(uint8_t o) noexcept;
294 TVG_DEPRECATED
Result bounds(
float* x,
float* y,
float* w,
float* h)
const noexcept;
312 Result bounds(
float* x,
float* y,
float* w,
float* h,
bool transformed)
const noexcept;
322 Paint* duplicate()
const noexcept;
329 uint8_t opacity()
const noexcept;
342 _TVG_DECLARE_ACCESSOR();
343 _TVG_DECALRE_IDENTIFIER();
344 _TVG_DECLARE_PRIVATE(
Paint);
402 uint32_t colorStops(
const ColorStop** colorStops)
const noexcept;
418 Fill* duplicate() const noexcept;
420 _TVG_DECALRE_IDENTIFIER();
421 _TVG_DECLARE_PRIVATE(
Fill);
451 Result reserve(uint32_t n) noexcept;
470 virtual Result push(std::unique_ptr<Paint> paint) noexcept;
482 virtual Result clear(
bool free =
true) noexcept;
496 virtual Result update(
Paint* paint =
nullptr) noexcept;
506 virtual Result draw() noexcept;
517 virtual Result sync() noexcept;
519 _TVG_DECLARE_PRIVATE(
Canvas);
550 Result linear(
float x1,
float y1,
float x2,
float y2) noexcept;
566 Result linear(
float* x1,
float* y1,
float* x2,
float* y2)
const noexcept;
573 static std::unique_ptr<LinearGradient> gen() noexcept;
601 Result radial(
float cx,
float cy,
float radius) noexcept;
614 Result radial(
float* cx,
float* cy,
float* radius)
const noexcept;
621 static std::unique_ptr<RadialGradient> gen() noexcept;
665 Result moveTo(
float x,
float y) noexcept;
679 Result lineTo(
float x,
float y) noexcept;
698 Result cubicTo(
float cx1,
float cy1,
float cx2,
float cy2,
float x,
float y) noexcept;
735 Result appendRect(
float x,
float y,
float w,
float h,
float rx,
float ry) noexcept;
753 Result appendCircle(
float cx,
float cy,
float rx,
float ry) noexcept;
772 Result appendArc(
float cx,
float cy,
float radius,
float startAngle,
float sweep,
bool pie) noexcept;
799 Result stroke(
float width) noexcept;
811 Result stroke(uint8_t r, uint8_t g, uint8_t b, uint8_t a) noexcept;
822 Result stroke(std::unique_ptr<Fill> f) noexcept;
838 Result stroke(
const float* dashPattern, uint32_t cnt) noexcept;
874 Result fill(uint8_t r, uint8_t g, uint8_t b, uint8_t a) noexcept;
887 Result fill(std::unique_ptr<Fill> f) noexcept;
905 uint32_t pathCommands(
const PathCommand** cmds)
const noexcept;
914 uint32_t pathCoords(
const Point** pts)
const noexcept;
921 const Fill* fill()
const noexcept;
933 Result fillColor(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a)
const noexcept;
947 float strokeWidth()
const noexcept;
959 Result strokeColor(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a)
const noexcept;
966 const Fill* strokeFill()
const noexcept;
975 uint32_t strokeDash(
const float** dashPattern)
const noexcept;
996 static std::unique_ptr<Shape> gen() noexcept;
998 _TVG_DECLARE_PRIVATE(
Shape);
1028 Result load(
const std::string& path) noexcept;
1046 TVG_DEPRECATED
Result load(
const char* data, uint32_t size,
bool copy =
false) noexcept;
1065 Result load(
const char* data, uint32_t size,
const std::string& mimeType,
bool copy =
false) noexcept;
1078 Result size(
float w,
float h) noexcept;
1088 Result size(
float* w,
float* h)
const noexcept;
1097 const uint32_t* data(uint32_t* w, uint32_t* h)
const noexcept;
1106 Result load(uint32_t* data, uint32_t w, uint32_t h,
bool copy) noexcept;
1115 Result viewbox(
float* x,
float* y,
float* w,
float* h)
const noexcept;
1122 static std::unique_ptr<Picture> gen() noexcept;
1124 _TVG_DECLARE_PRIVATE(
Picture);
1158 Result push(std::unique_ptr<Paint> paint) noexcept;
1170 Result reserve(uint32_t size) noexcept;
1185 Result clear(
bool free =
true) noexcept;
1192 static std::unique_ptr<Scene> gen() noexcept;
1194 _TVG_DECLARE_PRIVATE(
Scene);
1246 Result target(uint32_t* buffer, uint32_t stride, uint32_t w, uint32_t h, Colorspace cs) noexcept;
1271 Result mempool(MempoolPolicy policy) noexcept;
1277 static std::unique_ptr<SwCanvas> gen() noexcept;
1304 Result target(uint32_t* buffer, uint32_t stride, uint32_t w, uint32_t h) noexcept;
1313 static std::unique_ptr<GlCanvas> gen() noexcept;
1411 Result save(std::unique_ptr<Paint> paint,
const std::string& path,
bool compress =
true) noexcept;
1437 static std::unique_ptr<Saver> gen() noexcept;
1439 _TVG_DECLARE_PRIVATE(
Saver);
A data structure storing the information about the color and its relative position inside the gradien...
Definition: thorvg.h:365
@ MemoryCorruption
The value returned in the event of bad memory handling - e.g. failing in pointer releasing or casting...
@ InvalidArguments
The value returned in the event of a problem with the arguments given to the API - e....
An abstract class for managing graphical elements.
Definition: thorvg.h:198
@ Repeat
The gradient pattern is repeated continuously beyond the gradient area until the expected region is f...
StrokeCap
Enumeration determining the ending type of a stroke in the open sub-paths.
Definition: thorvg.h:108
@ Winding
A line from the point to a location outside the shape is drawn. The intersections of the line with th...
@ NonSupport
The value returned in case of choosing unsupported options.
Colorspace
Enumeration specifying the methods of combining the 8-bit color channels into 32-bit color.
Definition: thorvg.h:1211
FillRule
Enumeration specifying the algorithm used to establish which parts of the shape are treated as the in...
Definition: thorvg.h:138
Result
Enumeration specifying the result from the APIs.
Definition: thorvg.h:80
FillSpread
Enumeration specifying how to fill the area outside the gradient bounds.
Definition: thorvg.h:128
@ Success
The value returned in case of a correct request execution.
uint8_t r
Definition: thorvg.h:368
@ Butt
The stroke ends exactly at each of the two end-points of a sub-path. For zero length sub-paths no str...
@ MoveTo
Sets a new initial point of the sub-path and a new current point. This command expects 1 point: the s...
float offset
Definition: thorvg.h:367
CanvasEngine
Enumeration specifying the engine type used for the graphics backend. For multiple backeneds bitwise ...
Definition: thorvg.h:158
A class for the rendering graphical elements with a software raster engine.
Definition: thorvg.h:1203
@ Shareable
Memory Pool is shared among the SwCanvases.
Definition: thorvg.h:1224
CompositeMethod
Enumeration indicating the method used in the composition of two objects - the target and the source.
Definition: thorvg.h:147
A data structure representing a point in two-dimensional space.
Definition: thorvg.h:168
A class to composite children paints.
Definition: thorvg.h:1139
PathCommand
Enumeration specifying the values of the path commands accepted by TVG.
Definition: thorvg.h:97
A class for the rendering graphic elements with a GL raster engine.
Definition: thorvg.h:1292
uint8_t b
Definition: thorvg.h:370
@ ClipPath
The intersection of the source and the target is determined and only the resulting pixels from the so...
A class representing two-dimensional figures and their properties.
Definition: thorvg.h:639
@ Reflect
The gradient pattern is reflected outside the gradient area until the expected region is filled.
An abstract class representing the gradient fill of the Shape object.
Definition: thorvg.h:359
uint8_t a
Definition: thorvg.h:371
@ Round
The stroke is extended in both end-points of a sub-path by a half circle, with a radius equal to the ...
@ None
No composition is applied.
@ Unknown
The value returned in all other cases.
@ CubicTo
Draws a cubic Bezier curve from the current point to the given point using two given control points a...
@ InvAlphaMask
The pixels of the source and the complement to the target's pixels are alpha blended....
A class that enables initialization and termination of the TVG engines.
Definition: thorvg.h:1324
@ AlphaMask
The pixels of the source and the target are alpha blended. As a result, only the part of the source,...
@ Miter
The outer corner of the joined path segments is spiked. The spike is created by extension beyond the ...
@ LineTo
Draws a line from the current point to the given point and sets a new value of the current point....
@ FailedAllocation
The value returned in case of unsuccessful memory allocation.
@ EvenOdd
A line from the point to a location outside the shape is drawn and its intersections with the path se...
A data structure representing a three-dimensional matrix.
Definition: thorvg.h:181
MempoolPolicy
Enumeration specifying the methods of Memory Pool behavior policy.
Definition: thorvg.h:1221
@ InsufficientCondition
The value returned in case the request cannot be processed - e.g. asking for properties of an object,...
@ Bevel
The outer corner of the joined path segments is bevelled at the join point. The triangular region of ...
@ Close
Ends the current sub-path and connects it with its initial point. This command doesn't expect any poi...
@ Pad
The remaining area is filled with the closest stop color.
StrokeJoin
Enumeration determining the style used at the corners of joined stroked path segments.
Definition: thorvg.h:118
A class representing the linear gradient fill of the Shape object.
Definition: thorvg.h:531
A class representing an image read in one of the supported formats: raw, svg, png and etc....
Definition: thorvg.h:1010
A class representing the radial gradient fill of the Shape object.
Definition: thorvg.h:585
An abstract class for drawing graphical elements.
Definition: thorvg.h:435
uint8_t g
Definition: thorvg.h:369
A class for exporting a paint object into a specified file, from which to recover the paint data late...
Definition: thorvg.h:1386
@ Square
The stroke is extended in both end-points of a sub-path by a rectangle, with the width equal to the s...