 |
ThorVG
v0.6
|
21 #if defined(_MSC_VER) && !defined(__clang__)
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 IteratorAccessor
56 #define _TVG_DECALRE_IDENTIFIER() \
64 class IteratorAccessor;
212 Result rotate(
float degree) noexcept;
221 Result scale(
float factor) noexcept;
234 Result translate(
float x,
float y) noexcept;
257 Matrix transform() noexcept;
268 Result opacity(uint8_t o) noexcept;
293 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;
321 Paint* duplicate()
const noexcept;
328 uint8_t opacity()
const noexcept;
352 _TVG_DECLARE_ACCESSOR();
353 _TVG_DECALRE_IDENTIFIER();
354 _TVG_DECLARE_PRIVATE(
Paint);
425 uint32_t colorStops(
const ColorStop** colorStops)
const noexcept;
443 Matrix transform() const noexcept;
452 Fill* duplicate() const noexcept;
463 uint32_t identifier()
const {
return _id; }
465 _TVG_DECALRE_IDENTIFIER();
466 _TVG_DECLARE_PRIVATE(
Fill);
496 Result reserve(uint32_t n) noexcept;
515 virtual Result push(std::unique_ptr<Paint> paint) noexcept;
527 virtual Result clear(
bool free =
true) noexcept;
541 virtual Result update(
Paint* paint =
nullptr) noexcept;
551 virtual Result draw() noexcept;
562 virtual Result sync() noexcept;
564 _TVG_DECLARE_PRIVATE(
Canvas);
597 Result linear(
float x1,
float y1,
float x2,
float y2) noexcept;
613 Result linear(
float* x1,
float* y1,
float* x2,
float* y2)
const noexcept;
620 static std::unique_ptr<LinearGradient> gen() noexcept;
631 static uint32_t identifier() noexcept;
659 Result radial(
float cx,
float cy,
float radius) noexcept;
672 Result radial(
float* cx,
float* cy,
float* radius)
const noexcept;
679 static std::unique_ptr<RadialGradient> gen() noexcept;
690 static uint32_t identifier() noexcept;
734 Result moveTo(
float x,
float y) noexcept;
748 Result lineTo(
float x,
float y) noexcept;
767 Result cubicTo(
float cx1,
float cy1,
float cx2,
float cy2,
float x,
float y) noexcept;
804 Result appendRect(
float x,
float y,
float w,
float h,
float rx,
float ry) noexcept;
822 Result appendCircle(
float cx,
float cy,
float rx,
float ry) noexcept;
841 Result appendArc(
float cx,
float cy,
float radius,
float startAngle,
float sweep,
bool pie) noexcept;
868 Result stroke(
float width) noexcept;
880 Result stroke(uint8_t r, uint8_t g, uint8_t b, uint8_t a) noexcept;
891 Result stroke(std::unique_ptr<Fill> f) noexcept;
906 Result stroke(
const float* dashPattern, uint32_t cnt) noexcept;
942 Result fill(uint8_t r, uint8_t g, uint8_t b, uint8_t a) noexcept;
955 Result fill(std::unique_ptr<Fill> f) noexcept;
973 uint32_t pathCommands(
const PathCommand** cmds)
const noexcept;
982 uint32_t pathCoords(
const Point** pts)
const noexcept;
989 const Fill* fill()
const noexcept;
1001 Result fillColor(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a)
const noexcept;
1008 FillRule fillRule()
const noexcept;
1015 float strokeWidth()
const noexcept;
1027 Result strokeColor(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a)
const noexcept;
1034 const Fill* strokeFill()
const noexcept;
1043 uint32_t strokeDash(
const float** dashPattern)
const noexcept;
1064 static std::unique_ptr<Shape> gen() noexcept;
1075 static uint32_t identifier() noexcept;
1077 _TVG_DECLARE_PRIVATE(
Shape);
1107 Result load(
const std::string& path) noexcept;
1125 TVG_DEPRECATED
Result load(
const char* data, uint32_t size,
bool copy =
false) noexcept;
1144 Result load(
const char* data, uint32_t size,
const std::string& mimeType,
bool copy =
false) noexcept;
1157 Result size(
float w,
float h) noexcept;
1167 Result size(
float* w,
float* h)
const noexcept;
1176 const uint32_t* data(uint32_t* w, uint32_t* h)
const noexcept;
1185 Result load(uint32_t* data, uint32_t w, uint32_t h,
bool copy) noexcept;
1194 Result viewbox(
float* x,
float* y,
float* w,
float* h)
const noexcept;
1201 static std::unique_ptr<Picture> gen() noexcept;
1212 static uint32_t identifier() noexcept;
1214 _TVG_DECLARE_PRIVATE(
Picture);
1248 Result push(std::unique_ptr<Paint> paint) noexcept;
1260 Result reserve(uint32_t size) noexcept;
1274 Result clear(
bool free =
true) noexcept;
1281 static std::unique_ptr<Scene> gen() noexcept;
1292 static uint32_t identifier() noexcept;
1294 _TVG_DECLARE_PRIVATE(
Scene);
1348 Result target(uint32_t* buffer, uint32_t stride, uint32_t w, uint32_t h, Colorspace cs) noexcept;
1373 Result mempool(MempoolPolicy policy) noexcept;
1379 static std::unique_ptr<SwCanvas> gen() noexcept;
1406 Result target(uint32_t* buffer, uint32_t stride, uint32_t w, uint32_t h) noexcept;
1415 static std::unique_ptr<GlCanvas> gen() noexcept;
1515 Result save(std::unique_ptr<Paint> paint,
const std::string& path,
bool compress =
true) noexcept;
1541 static std::unique_ptr<Saver> gen() noexcept;
1543 _TVG_DECLARE_PRIVATE(
Saver);
A data structure storing the information about the color and its relative position inside the gradien...
Definition: thorvg.h:375
@ 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:197
@ ABGR8888_STRAIGHT
@BETA_API The channels are joined in the order: alpha, blue, green, red. Colors are un-alpha-premulti...
Definition: thorvg.h:1315
@ 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:107
@ 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:1311
FillRule
Enumeration specifying the algorithm used to establish which parts of the shape are treated as the in...
Definition: thorvg.h:137
Result
Enumeration specifying the result from the APIs.
Definition: thorvg.h:79
@ ARGB8888
The channels are joined in the order: alpha, red, green, blue. Colors are alpha-premultiplied.
Definition: thorvg.h:1314
FillSpread
Enumeration specifying how to fill the area outside the gradient bounds.
Definition: thorvg.h:127
@ Success
The value returned in case of a correct request execution.
uint8_t r
Definition: thorvg.h:378
@ 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:377
CanvasEngine
Enumeration specifying the engine type used for the graphics backend. For multiple backends bitwise o...
Definition: thorvg.h:157
A class for the rendering graphical elements with a software raster engine.
Definition: thorvg.h:1303
@ Shareable
Memory Pool is shared among the SwCanvases.
Definition: thorvg.h:1326
CompositeMethod
Enumeration indicating the method used in the composition of two objects - the target and the source.
Definition: thorvg.h:146
A data structure representing a point in two-dimensional space.
Definition: thorvg.h:167
A class to composite children paints.
Definition: thorvg.h:1229
PathCommand
Enumeration specifying the values of the path commands accepted by TVG.
Definition: thorvg.h:96
A class for the rendering graphic elements with a GL raster engine.
Definition: thorvg.h:1394
uint8_t b
Definition: thorvg.h:380
@ 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:708
@ 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:369
uint8_t a
Definition: thorvg.h:381
@ 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:1426
@ 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...
@ ARGB8888_STRAIGHT
@BETA_API The channels are joined in the order: alpha, red, green, blue. Colors are un-alpha-premulti...
Definition: thorvg.h:1316
A data structure representing a three-dimensional matrix.
Definition: thorvg.h:180
MempoolPolicy
Enumeration specifying the methods of Memory Pool behavior policy.
Definition: thorvg.h:1323
@ 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:117
A class representing the linear gradient fill of the Shape object.
Definition: thorvg.h:576
A class representing an image read in one of the supported formats: raw, svg, png,...
Definition: thorvg.h:1089
A class representing the radial gradient fill of the Shape object.
Definition: thorvg.h:643
An abstract class for drawing graphical elements.
Definition: thorvg.h:480
uint8_t g
Definition: thorvg.h:379
uint32_t identifier() const
Return the unique id value of the paint instance.
Definition: thorvg.h:350
A class for exporting a paint object into a specified file, from which to recover the paint data late...
Definition: thorvg.h:1488
@ Square
The stroke is extended in both end-points of a sub-path by a rectangle, with the width equal to the s...