20 #define TVG_EXPORT __attribute__ ((visibility ("default"))) 30 #define _TVG_DECLARE_PRIVATE(A) \ 34 A(const A&) = delete; \ 35 const A& operator=(const A&) = delete; \ 38 #define _TVG_DISABLE_CTOR(A) \ 42 #define _TVG_DECLARE_ACCESSOR() \ 47 #define _TVG_DECALRE_IDENTIFIER() \ 48 auto id() const { return _id; } \ 203 Result rotate(
float degree) noexcept;
212 Result scale(
float factor) noexcept;
225 Result translate(
float x,
float y) noexcept;
248 Result opacity(uint8_t o) noexcept;
273 Result bounds(
float* x,
float* y,
float* w,
float* h)
const noexcept;
282 Paint* duplicate()
const noexcept;
289 uint8_t opacity()
const noexcept;
291 _TVG_DECLARE_ACCESSOR();
292 _TVG_DECLARE_PRIVATE(
Paint);
350 uint32_t colorStops(
const ColorStop** colorStops)
const noexcept;
366 Fill* duplicate() const noexcept;
368 _TVG_DECALRE_IDENTIFIER();
369 _TVG_DECLARE_PRIVATE(
Fill);
386 Canvas(RenderMethod*);
399 Result reserve(uint32_t n) noexcept;
418 virtual Result push(std::unique_ptr<Paint> paint) noexcept;
430 virtual Result clear(
bool free =
true) noexcept;
454 virtual Result draw() noexcept;
465 virtual Result sync() noexcept;
467 _TVG_DECLARE_PRIVATE(Canvas);
498 Result linear(
float x1,
float y1,
float x2,
float y2) noexcept;
514 Result linear(
float* x1,
float* y1,
float* x2,
float* y2)
const noexcept;
521 static std::unique_ptr<LinearGradient> gen() noexcept;
549 Result radial(
float cx,
float cy,
float radius) noexcept;
562 Result radial(
float* cx,
float* cy,
float* radius)
const noexcept;
569 static std::unique_ptr<RadialGradient> gen() noexcept;
613 Result moveTo(
float x,
float y) noexcept;
627 Result lineTo(
float x,
float y) noexcept;
646 Result cubicTo(
float cx1,
float cy1,
float cx2,
float cy2,
float x,
float y) noexcept;
683 Result appendRect(
float x,
float y,
float w,
float h,
float rx,
float ry) noexcept;
701 Result appendCircle(
float cx,
float cy,
float rx,
float ry) noexcept;
720 Result appendArc(
float cx,
float cy,
float radius,
float startAngle,
float sweep,
bool pie) noexcept;
746 Result stroke(
float width) noexcept;
758 Result stroke(uint8_t r, uint8_t g, uint8_t b, uint8_t a) noexcept;
769 Result stroke(std::unique_ptr<Fill> f) noexcept;
784 Result stroke(
const float* dashPattern, uint32_t cnt) noexcept;
820 Result fill(uint8_t r, uint8_t g, uint8_t b, uint8_t a) noexcept;
833 Result fill(std::unique_ptr<Fill> f) noexcept;
851 uint32_t pathCommands(
const PathCommand** cmds)
const noexcept;
860 uint32_t pathCoords(
const Point** pts)
const noexcept;
867 const Fill* fill()
const noexcept;
879 Result fillColor(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a)
const noexcept;
893 float strokeWidth()
const noexcept;
905 Result strokeColor(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a)
const noexcept;
912 const Fill* strokeFill()
const noexcept;
921 uint32_t strokeDash(
const float** dashPattern)
const noexcept;
942 static std::unique_ptr<Shape> gen() noexcept;
944 _TVG_DECLARE_PRIVATE(
Shape);
974 Result load(
const std::string& path) noexcept;
989 Result load(
const char* data, uint32_t size) noexcept;
1002 Result size(
float w,
float h) noexcept;
1012 Result size(
float* w,
float* h)
const noexcept;
1021 const uint32_t* data()
const noexcept;
1030 Result load(uint32_t* data, uint32_t w, uint32_t h,
bool copy) noexcept;
1039 Result viewbox(
float* x,
float* y,
float* w,
float* h)
const noexcept;
1046 static std::unique_ptr<Picture> gen() noexcept;
1048 _TVG_DECLARE_PRIVATE(
Picture);
1082 Result push(std::unique_ptr<Paint> paint) noexcept;
1094 Result reserve(uint32_t size) noexcept;
1110 static std::unique_ptr<Scene> gen() noexcept;
1112 _TVG_DECLARE_PRIVATE(
Scene);
1165 Result target(uint32_t* buffer, uint32_t stride, uint32_t w, uint32_t h,
Colorspace cs) noexcept;
1196 static std::unique_ptr<SwCanvas> gen() noexcept;
1223 Result target(uint32_t* buffer, uint32_t stride, uint32_t w, uint32_t h) noexcept;
1232 static std::unique_ptr<GlCanvas> gen() noexcept;
The pixels of the source and the target are alpha blended. As a result, only the part of the source...
Draws a line from the current point to the given point and sets a new value of the current point...
The stroke is extended in both end-points of a sub-path by a half circle, with a radius equal to the ...
The value returned in all other cases.
The value returned in case of unsuccessful memory allocation.
MempoolPolicy
Enumeration specifying the methods of Memory Pool behavior policy.
Definition: thorvg.h:1140
Ends the current sub-path and connects it with its initial point. This command doesn't expect any poi...
An abstract class representing the gradient fill of the Shape object.
Definition: thorvg.h:307
uint8_t r
Definition: thorvg.h:316
Sets a new initial point of the sub-path and a new current point. This command expects 1 point: the s...
The value returned in case the request cannot be processed - e.g. asking for properties of an object...
StrokeCap
Enumeration determining the ending type of a stroke in the open sub-paths.
Definition: thorvg.h:98
The intersection of the source and the target is determined and only the resulting pixels from the so...
A class representing the radial gradient fill of the Shape object.
Definition: thorvg.h:533
FillRule
Enumeration specifying the algorithm used to establish which parts of the shape are treated as the in...
Definition: thorvg.h:128
A class to composite children paints.
Definition: thorvg.h:1063
The value returned in the event of bad memory handling - e.g. failing in pointer releasing or casting...
The gradient pattern is reflected outside the gradient area until the expected region is filled...
FillSpread
Enumeration specifying how to fill the area outside the gradient bounds.
Definition: thorvg.h:118
uint8_t a
Definition: thorvg.h:319
A data structure representing a point in two-dimensional space.
Definition: thorvg.h:158
A class representing two-dimensional figures and their properties.
Definition: thorvg.h:587
Memory Pool is shared among the SwCanvases.
Definition: thorvg.h:1143
No composition is applied.
A line from the point to a location outside the shape is drawn. The intersections of the line with th...
The pixels of the source and the complement to the target's pixels are alpha blended. As a result, only the part of the source which is not covered by the target is visible.
StrokeJoin
Enumeration determining the style used at the corners of joined stroked path segments.
Definition: thorvg.h:108
A class representing an image read in one of the supported formats: raw, svg, png and etc...
Definition: thorvg.h:956
The remaining area is filled with the closest stop color.
PathCommand
Enumeration specifying the values of the path commands accepted by TVG.
Definition: thorvg.h:87
The value returned in the event of a problem with the arguments given to the API - e...
The value returned in case of a correct request execution.
A class for the rendering graphical elements with a software raster engine.
Definition: thorvg.h:1121
Draws a cubic Bezier curve from the current point to the given point using two given control points a...
The stroke ends exactly at each of the two end-points of a sub-path. For zero length sub-paths no str...
The gradient pattern is repeated continuously beyond the gradient area until the expected region is f...
Colorspace
Enumeration specifying the methods of combining the 8-bit color channels into 32-bit color...
Definition: thorvg.h:1129
A class for the rendering graphic elements with a GL raster engine.
Definition: thorvg.h:1211
The outer corner of the joined path segments is bevelled at the join point. The triangular region of ...
The stroke is extended in both end-points of a sub-path by a rectangle, with the width equal to the s...
A data structure storing the information about the color and its relative position inside the gradien...
Definition: thorvg.h:313
uint8_t b
Definition: thorvg.h:318
Result
Enumeration specifying the result from the APIs.
Definition: thorvg.h:70
CompositeMethod
Enumeration indicating the method used in the composition of two objects - the target and the source...
Definition: thorvg.h:137
An abstract class for managing graphical elements.
Definition: thorvg.h:188
The value returned in case of choosing unsupported options.
An abstract class for drawing graphical elements.
Definition: thorvg.h:383
float offset
Definition: thorvg.h:315
uint8_t g
Definition: thorvg.h:317
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:171
CanvasEngine
Enumeration specifying the engine type used for the graphics backend. For multiple backeneds bitwise ...
Definition: thorvg.h:148
The outer corner of the joined path segments is spiked. The spike is created by extension beyond the ...
A class representing the linear gradient fill of the Shape object.
Definition: thorvg.h:479
A class that enables initialization and termination of the TVG engines.
Definition: thorvg.h:1243