# ThorVG: /home/hermet/thorvg/inc/thorvg.h Source File

thorvg.h
#ifndef _THORVG_H_
#define _THORVG_H_
#include <functional>
#include <memory>
#include <string>
#include <list>
#ifdef TVG_API
#undef TVG_API
#endif
#ifndef TVG_STATIC
#ifdef _WIN32
#if TVG_BUILD
#define TVG_API __declspec(dllexport)
#else
#define TVG_API __declspec(dllimport)
#endif
#elif (defined(__SUNPRO_C) || defined(__SUNPRO_CC))
#define TVG_API __global
#else
#if (defined(__GNUC__) && __GNUC__ >= 4) || defined(__INTEL_COMPILER)
#define TVG_API __attribute__ ((visibility("default")))
#else
#define TVG_API
#endif
#endif
#else
#define TVG_API
#endif
#ifdef TVG_DEPRECATED
#undef TVG_DEPRECATED
#endif
#ifdef _WIN32
#define TVG_DEPRECATED __declspec(deprecated)
#elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
#define TVG_DEPRECATED __attribute__ ((__deprecated__))
#else
#define TVG_DEPRECATED
#endif
#define _TVG_DECLARE_PRIVATE(A) \
struct Impl; \
Impl* pImpl; \
protected: \
A(const A&) = delete; \
const A& operator=(const A&) = delete; \
A()
#define _TVG_DISABLE_CTOR(A) \
A() = delete; \
~A() = delete
#define _TVG_DECLARE_ACCESSOR(A) \
friend A
namespace tvg
{
class RenderMethod;
class Animation;
enum class Result
{
Success = 0,
InvalidArguments,
InsufficientCondition,
FailedAllocation,
MemoryCorruption,
NonSupport,
Unknown
};
enum class PathCommand
{
Close = 0,
MoveTo,
LineTo,
CubicTo
};
enum class StrokeCap
{
Square = 0,
Round,
Butt
};
enum class StrokeJoin
{
Bevel = 0,
Round,
Miter
};
enum class FillSpread
{
Pad = 0,
Reflect,
Repeat
};
enum class FillRule
{
Winding = 0,
EvenOdd
};
enum class CompositeMethod
{
None = 0,
ClipPath,
AlphaMask,
InvAlphaMask,
LumaMask,
InvLumaMask,
AddMask,
SubtractMask,
IntersectMask,
DifferenceMask,
LightenMask,
DarkenMask
};
enum class BlendMethod : uint8_t
{
Normal = 0,
Multiply,
Screen,
Overlay,
Darken,
Lighten,
ColorDodge,
ColorBurn,
HardLight,
SoftLight,
Difference,
Exclusion,
Hue,
Saturation,
Color,
Luminosity,
Add,
HardMix
};
enum class SceneEffect : uint8_t
{
ClearAll = 0,
GaussianBlur
};
enum class CanvasEngine
{
Sw = (1 << 1),
Gl = (1 << 2),
Wg = (1 << 3),
};
enum class Type : uint8_t
{
Undefined = 0,
Shape,
Scene,
Picture,
Text,
LinearGradient = 10,
RadialGradient
};
struct Point
{
float x, y;
};
struct Matrix
{
float e11, e12, e13;
float e21, e22, e23;
float e31, e32, e33;
};
class TVG_API Paint
{
public:
virtual ~Paint();
Result rotate(float degree) noexcept;
Result scale(float factor) noexcept;
Result translate(float x, float y) noexcept;
Result transform(const Matrix& m) noexcept;
Matrix transform() noexcept;
Result opacity(uint8_t o) noexcept;
Result composite(std::unique_ptr<Paint> target, CompositeMethod method) noexcept;
Result clip(std::unique_ptr<Paint> clipper) noexcept;
Result blend(BlendMethod method) noexcept;
TVG_DEPRECATED Result bounds(float* x, float* y, float* w, float* h) const noexcept;
Result bounds(float* x, float* y, float* w, float* h, bool transformed) const noexcept;
Paint* duplicate() const noexcept;
uint8_t opacity() const noexcept;
CompositeMethod composite(const Paint** target) const noexcept;
virtual Type type() const noexcept = 0;
uint32_t id = 0;
TVG_DEPRECATED uint32_t identifier() const noexcept;
_TVG_DECLARE_PRIVATE(Paint);
};
class TVG_API Fill
{
public:
struct ColorStop
{
float offset;
uint8_t r;
uint8_t g;
uint8_t b;
uint8_t a;
};
virtual ~Fill();
Result colorStops(const ColorStop* colorStops, uint32_t cnt) noexcept;
Result spread(FillSpread s) noexcept;
Result transform(const Matrix& m) noexcept;
uint32_t colorStops(const ColorStop** colorStops) const noexcept;
FillSpread spread() const noexcept;
Matrix transform() const noexcept;
Fill* duplicate() const noexcept;
virtual Type type() const noexcept = 0;
TVG_DEPRECATED uint32_t identifier() const noexcept;
_TVG_DECLARE_PRIVATE(Fill);
};
class TVG_API Canvas
{
public:
Canvas(RenderMethod*);
virtual ~Canvas();
TVG_DEPRECATED Result reserve(uint32_t n) noexcept;
std::list<Paint*>& paints() noexcept;
virtual Result push(std::unique_ptr<Paint> paint) noexcept;
virtual Result clear(bool free = true) noexcept;
virtual Result update(Paint* paint = nullptr) noexcept;
virtual Result draw() noexcept;
virtual Result viewport(int32_t x, int32_t y, int32_t w, int32_t h) noexcept;
virtual Result sync() noexcept;
_TVG_DECLARE_PRIVATE(Canvas);
};
class TVG_API LinearGradient final : public Fill
{
public:
~LinearGradient();
Result linear(float x1, float y1, float x2, float y2) noexcept;
Result linear(float* x1, float* y1, float* x2, float* y2) const noexcept;
static std::unique_ptr<LinearGradient> gen() noexcept;
Type type() const noexcept override;
TVG_DEPRECATED static uint32_t identifier() noexcept;
_TVG_DECLARE_PRIVATE(LinearGradient);
};
class TVG_API RadialGradient final : public Fill
{
public:
~RadialGradient();
Result radial(float cx, float cy, float radius) noexcept;
Result radial(float* cx, float* cy, float* radius) const noexcept;
static std::unique_ptr<RadialGradient> gen() noexcept;
Type type() const noexcept override;
TVG_DEPRECATED static uint32_t identifier() noexcept;
_TVG_DECLARE_PRIVATE(RadialGradient);
};
class TVG_API Shape final : public Paint
{
public:
~Shape();
Result reset() noexcept;
Result moveTo(float x, float y) noexcept;
Result lineTo(float x, float y) noexcept;
Result cubicTo(float cx1, float cy1, float cx2, float cy2, float x, float y) noexcept;
Result close() noexcept;
Result appendRect(float x, float y, float w, float h, float rx = 0, float ry = 0) noexcept;
Result appendCircle(float cx, float cy, float rx, float ry) noexcept;
TVG_DEPRECATED Result appendArc(float cx, float cy, float radius, float startAngle, float sweep, bool pie) noexcept;
Result appendPath(const PathCommand* cmds, uint32_t cmdCnt, const Point* pts, uint32_t ptsCnt) noexcept;
Result stroke(float width) noexcept;
Result stroke(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255) noexcept;
Result stroke(std::unique_ptr<Fill> f) noexcept;
Result stroke(const float* dashPattern, uint32_t cnt) noexcept;
Result stroke(StrokeCap cap) noexcept;
Result stroke(StrokeJoin join) noexcept;
Result strokeMiterlimit(float miterlimit) noexcept;
Result strokeTrim(float begin, float end, bool simultaneous = true) noexcept;
Result fill(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255) noexcept;
Result fill(std::unique_ptr<Fill> f) noexcept;
Result fill(FillRule r) noexcept;
Result order(bool strokeFirst) noexcept;
uint32_t pathCommands(const PathCommand** cmds) const noexcept;
uint32_t pathCoords(const Point** pts) const noexcept;
const Fill* fill() const noexcept;
Result fillColor(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a = nullptr) const noexcept;
FillRule fillRule() const noexcept;
float strokeWidth() const noexcept;
Result strokeColor(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a = nullptr) const noexcept;
const Fill* strokeFill() const noexcept;
uint32_t strokeDash(const float** dashPattern) const noexcept;
StrokeCap strokeCap() const noexcept;
StrokeJoin strokeJoin() const noexcept;
float strokeMiterlimit() const noexcept;
static std::unique_ptr<Shape> gen() noexcept;
Type type() const noexcept override;
TVG_DEPRECATED static uint32_t identifier() noexcept;
_TVG_DECLARE_PRIVATE(Shape);
};
class TVG_API Picture final : public Paint
{
public:
~Picture();
Result load(const std::string& path) noexcept;
TVG_DEPRECATED Result load(const char* data, uint32_t size, bool copy = false) noexcept;
Result load(const char* data, uint32_t size, const std::string& mimeType, bool copy = false) noexcept;
Result size(float w, float h) noexcept;
Result size(float* w, float* h) const noexcept;
Result load(uint32_t* data, uint32_t w, uint32_t h, bool copy) noexcept;
const Paint* paint(uint32_t id) noexcept;
static std::unique_ptr<Picture> gen() noexcept;
Type type() const noexcept override;
TVG_DEPRECATED static uint32_t identifier() noexcept;
_TVG_DECLARE_ACCESSOR(Animation);
_TVG_DECLARE_PRIVATE(Picture);
};
class TVG_API Scene final : public Paint
{
public:
~Scene();
Result push(std::unique_ptr<Paint> paint) noexcept;
TVG_DEPRECATED Result reserve(uint32_t size) noexcept;
std::list<Paint*>& paints() noexcept;
Result clear(bool free = true) noexcept;
Result push(SceneEffect effect, ...) noexcept;
static std::unique_ptr<Scene> gen() noexcept;
Type type() const noexcept override;
TVG_DEPRECATED static uint32_t identifier() noexcept;
_TVG_DECLARE_PRIVATE(Scene);
};
class TVG_API Text final : public Paint
{
public:
~Text();
Result font(const char* name, float size, const char* style = nullptr) noexcept;
Result text(const char* text) noexcept;
Result fill(uint8_t r, uint8_t g, uint8_t b) noexcept;
Result fill(std::unique_ptr<Fill> f) noexcept;
static Result load(const std::string& path) noexcept;
static Result load(const char* name, const char* data, uint32_t size, const std::string& mimeType = "ttf", bool copy = false) noexcept;
static Result unload(const std::string& path) noexcept;
static std::unique_ptr<Text> gen() noexcept;
Type type() const noexcept override;
_TVG_DECLARE_PRIVATE(Text);
};
class TVG_API SwCanvas final : public Canvas
{
public:
~SwCanvas();
enum Colorspace
{
ABGR8888 = 0,
ARGB8888,
ABGR8888S,
ARGB8888S,
};
enum MempoolPolicy
{
Default = 0,
Shareable,
Individual
};
Result target(uint32_t* buffer, uint32_t stride, uint32_t w, uint32_t h, Colorspace cs) noexcept;
Result mempool(MempoolPolicy policy) noexcept;
static std::unique_ptr<SwCanvas> gen() noexcept;
_TVG_DECLARE_PRIVATE(SwCanvas);
};
class TVG_API GlCanvas final : public Canvas
{
public:
~GlCanvas();
Result target(int32_t id, uint32_t w, uint32_t h) noexcept;
static std::unique_ptr<GlCanvas> gen() noexcept;
_TVG_DECLARE_PRIVATE(GlCanvas);
};
class TVG_API WgCanvas final : public Canvas
{
public:
~WgCanvas();
Result target(void* instance, void* surface, uint32_t w, uint32_t h, void* device = nullptr) noexcept;
static std::unique_ptr<WgCanvas> gen() noexcept;
_TVG_DECLARE_PRIVATE(WgCanvas);
};
class TVG_API Initializer final
{
public:
static Result init(CanvasEngine engine, uint32_t threads) noexcept;
static Result term(CanvasEngine engine) noexcept;
static const char* version(uint32_t* major, uint32_t* minor, uint32_t* micro) noexcept;
_TVG_DISABLE_CTOR(Initializer);
};
class TVG_API Animation
{
public:
~Animation();
Result frame(float no) noexcept;
Picture* picture() const noexcept;
float curFrame() const noexcept;
float totalFrame() const noexcept;
float duration() const noexcept;
Result segment(float begin, float end) noexcept;
Result segment(float* begin, float* end = nullptr) noexcept;
static std::unique_ptr<Animation> gen() noexcept;
_TVG_DECLARE_PRIVATE(Animation);
};
class TVG_API Saver final
{
public:
~Saver();
Result background(std::unique_ptr<Paint> paint) noexcept;
Result save(std::unique_ptr<Paint> paint, const std::string& path, bool compress = true) noexcept;
Result save(std::unique_ptr<Animation> animation, const std::string& path, uint32_t quality = 100, uint32_t fps = 0) noexcept;
Result sync() noexcept;
static std::unique_ptr<Saver> gen() noexcept;
_TVG_DECLARE_PRIVATE(Saver);
};
class TVG_API Accessor final
{
public:
~Accessor();
TVG_DEPRECATED std::unique_ptr<Picture> set(std::unique_ptr<Picture> picture, std::function<bool(const Paint* paint)> func) noexcept;
Result set(const Picture* picture, std::function<bool(const Paint* paint, void* data)> func, void* data) noexcept;
static uint32_t id(const char* name) noexcept;
static std::unique_ptr<Accessor> gen() noexcept;
_TVG_DECLARE_PRIVATE(Accessor);
};
template<typename T = tvg::Paint>
std::unique_ptr<T> cast(Paint* paint)
{
return std::unique_ptr<T>(static_cast<T*>(paint));
}
template<typename T = tvg::Fill>
std::unique_ptr<T> cast(Fill* fill)
{
return std::unique_ptr<T>(static_cast<T*>(fill));
}
} //namespace
#endif //_THORVG_H_
tvg::Accessor
The Accessor is a utility class to debug the Scene structure by traversing the scene-tree.
Definition: thorvg.h:2103
tvg::Accessor::set
Result set(const Picture *picture, std::function< bool(const Paint *paint, void *data)> func, void *data) noexcept
Set the access function for traversing the Picture scene tree nodes.
tvg::Accessor::id
static uint32_t id(const char *name) noexcept
Generate a unique ID (hash key) from a given name.
tvg::Accessor::gen
static std::unique_ptr< Accessor > gen() noexcept
Creates a new Accessor object.
tvg::Animation
The Animation class enables manipulation of animatable images.
Definition: thorvg.h:1872
tvg::Animation::picture
Picture * picture() const noexcept
Retrieves a picture instance associated with this animation instance.
tvg::Animation::frame
Result frame(float no) noexcept
Specifies the current frame in the animation.
tvg::Canvas
An abstract class for drawing graphical elements.
Definition: thorvg.h:590
tvg::Canvas::paints
std::list< Paint * > & paints() noexcept
Returns the list of the paints that currently held by the Canvas.
tvg::Fill
An abstract class representing the gradient fill of the Shape object.
Definition: thorvg.h:485
tvg::Fill::spread
FillSpread spread() const noexcept
Gets the FillSpread value of the fill.
tvg::Fill::colorStops
Result colorStops(const ColorStop *colorStops, uint32_t cnt) noexcept
Sets the parameters of the colors of the gradient and their position.
tvg::Fill::transform
Result transform(const Matrix &m) noexcept
Sets the matrix of the affine transformation for the gradient fill.
tvg::Fill::colorStops
uint32_t colorStops(const ColorStop **colorStops) const noexcept
Gets the parameters of the colors of the gradient, their position and number.
tvg::Fill::spread
Result spread(FillSpread s) noexcept
Sets the FillSpread value, which specifies how to fill the area outside the gradient bounds.
tvg::GlCanvas
A class for the rendering graphic elements with a GL raster engine.
Definition: thorvg.h:1721
tvg::GlCanvas::target
Result target(int32_t id, uint32_t w, uint32_t h) noexcept
Sets the drawing target for rasterization.
tvg::GlCanvas::gen
static std::unique_ptr< GlCanvas > gen() noexcept
Creates a new GlCanvas object.
tvg::Initializer
A class that enables initialization and termination of the TVG engines.
Definition: thorvg.h:1811
tvg::Initializer::term
static Result term(CanvasEngine engine) noexcept
Terminates TVG engines.
tvg::Initializer::init
static Result init(CanvasEngine engine, uint32_t threads) noexcept
Initializes TVG engines.
tvg::Initializer::version
static const char * version(uint32_t *major, uint32_t *minor, uint32_t *micro) noexcept
Retrieves the version of the TVG engine.
tvg::LinearGradient
A class representing the linear gradient fill of the Shape object.
Definition: thorvg.h:707
tvg::LinearGradient::gen
static std::unique_ptr< LinearGradient > gen() noexcept
Creates a new LinearGradient object.
tvg::LinearGradient::linear
Result linear(float *x1, float *y1, float *x2, float *y2) const noexcept
Gets the linear gradient bounds.
tvg::LinearGradient::linear
Result linear(float x1, float y1, float x2, float y2) noexcept
Sets the linear gradient bounds.
tvg::Paint
An abstract class for managing graphical elements.
Definition: thorvg.h:290
tvg::Paint::scale
Result scale(float factor) noexcept
Sets the scale value of the object.
tvg::Paint::rotate
Result rotate(float degree) noexcept
Sets the angle by which the object is rotated.
tvg::Paint::transform
Result transform(const Matrix &m) noexcept
Sets the matrix of the affine transformation for the object.
tvg::Paint::transform
Matrix transform() noexcept
Gets the matrix of the affine transformation of the object.
tvg::Paint::translate
Result translate(float x, float y) noexcept
Sets the values by which the object is moved in a two-dimensional space.
tvg::Picture
A class representing an image read in one of the supported formats: raw, svg, png,...
Definition: thorvg.h:1244
tvg::Picture::load
TVG_DEPRECATED Result load(const char *data, uint32_t size, bool copy=false) noexcept
tvg::Picture::load
Result load(const std::string &path) noexcept
Loads a picture data directly from a file.
tvg::RadialGradient
A class representing the radial gradient fill of the Shape object.
Definition: thorvg.h:776
tvg::RadialGradient::radial
Result radial(float cx, float cy, float radius) noexcept
Sets the radial gradient bounds.
tvg::RadialGradient::radial
Result radial(float *cx, float *cy, float *radius) const noexcept
Gets the radial gradient bounds.
tvg::RadialGradient::gen
static std::unique_ptr< RadialGradient > gen() noexcept
Creates a new RadialGradient object.
tvg::Saver
A class for exporting a paint object into a specified file, from which to recover the paint data late...
Definition: thorvg.h:2006
tvg::Saver::background
Result background(std::unique_ptr< Paint > paint) noexcept
Sets the base background content for the saved image.
tvg::Saver::save
Result save(std::unique_ptr< Paint > paint, const std::string &path, bool compress=true) noexcept
Exports the given paint data to the given path.
tvg::Scene
A class to composite children paints.
Definition: thorvg.h:1385
tvg::Scene::push
Result push(std::unique_ptr< Paint > paint) noexcept
Passes drawing elements to the Scene using Paint objects.
tvg::Scene::paints
std::list< Paint * > & paints() noexcept
Returns the list of the paints that currently held by the Scene.
tvg::Shape
A class representing two-dimensional figures and their properties.
Definition: thorvg.h:847
tvg::Shape::reset
Result reset() noexcept
Resets the shape path.
tvg::SwCanvas
A class for the rendering graphical elements with a software raster engine.
Definition: thorvg.h:1631
tvg::SwCanvas::target
Result target(uint32_t *buffer, uint32_t stride, uint32_t w, uint32_t h, Colorspace cs) noexcept
Sets the drawing target for the rasterization.
tvg::SwCanvas::mempool
Result mempool(MempoolPolicy policy) noexcept
Set sw engine memory pool behavior policy.
tvg::SwCanvas::Colorspace
Colorspace
Enumeration specifying the methods of combining the 8-bit color channels into 32-bit color.
Definition: thorvg.h:1639
tvg::SwCanvas::ARGB8888S
@ ARGB8888S
The channels are joined in the order: alpha, red, green, blue. Colors are un-alpha-premultiplied.
Definition: thorvg.h:1643
tvg::SwCanvas::ABGR8888S
@ ABGR8888S
The channels are joined in the order: alpha, blue, green, red. Colors are un-alpha-premultiplied.
Definition: thorvg.h:1642
tvg::SwCanvas::ARGB8888
@ ARGB8888
The channels are joined in the order: alpha, red, green, blue. Colors are alpha-premultiplied....
Definition: thorvg.h:1641
tvg::SwCanvas::MempoolPolicy
MempoolPolicy
Enumeration specifying the methods of Memory Pool behavior policy.
Definition: thorvg.h:1651
tvg::SwCanvas::Shareable
@ Shareable
Memory Pool is shared among the SwCanvases.
Definition: thorvg.h:1653
tvg::SwCanvas::gen
static std::unique_ptr< SwCanvas > gen() noexcept
Creates a new SwCanvas object.
tvg::Text
A class to represent text objects in a graphical context, allowing for rendering and manipulation of ...
Definition: thorvg.h:1480
tvg::Text::font
Result font(const char *name, float size, const char *style=nullptr) noexcept
Sets the font properties for the text.
tvg::WgCanvas
A class for the rendering graphic elements with a WebGPU raster engine.
Definition: thorvg.h:1769
tvg::WgCanvas::target
Result target(void *instance, void *surface, uint32_t w, uint32_t h, void *device=nullptr) noexcept
Sets the drawing target for the rasterization.
tvg::FillSpread
FillSpread
Enumeration specifying how to fill the area outside the gradient bounds.
Definition: thorvg.h:133
tvg::cast
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:2165
tvg::Result
Result
Enumeration specifying the result from the APIs.
Definition: thorvg.h:81
tvg::CanvasEngine
CanvasEngine
Enumeration specifying the engine type used for the graphics backend. For multiple backends bitwise o...
Definition: thorvg.h:227
tvg::BlendMethod
BlendMethod
Enumeration indicates the method used for blending paint. Please refer to the respective formulas for...
Definition: thorvg.h:184
tvg::Type
Type
Enumeration specifying the ThorVG class type value.
Definition: thorvg.h:245
tvg::StrokeCap
StrokeCap
Enumeration determining the ending type of a stroke in the open sub-paths.
Definition: thorvg.h:111
tvg::PathCommand
PathCommand
Enumeration specifying the values of the path commands accepted by TVG.
Definition: thorvg.h:99
tvg::SceneEffect
SceneEffect
Enumeration that defines methods used for Scene Effects.
Definition: thorvg.h:217
tvg::FillRule
FillRule
Enumeration specifying the algorithm used to establish which parts of the shape are treated as the in...
Definition: thorvg.h:144
tvg::CompositeMethod
CompositeMethod
Enumeration indicating the method used in the composition of two objects - the target and the source.
Definition: thorvg.h:158
tvg::StrokeJoin
StrokeJoin
Enumeration determining the style used at the corners of joined stroked path segments.
Definition: thorvg.h:122
tvg::FillSpread::Repeat
@ Repeat
The gradient pattern is repeated continuously beyond the gradient area until the expected region is f...
tvg::FillSpread::Reflect
@ Reflect
The gradient pattern is reflected outside the gradient area until the expected region is filled.
tvg::FillSpread::Pad
@ Pad
The remaining area is filled with the closest stop color.
tvg::Result::InsufficientCondition
@ InsufficientCondition
The value returned in case the request cannot be processed - e.g. asking for properties of an object,...
tvg::Result::Success
@ Success
The value returned in case of a correct request execution.
tvg::Result::Unknown
@ Unknown
The value returned in all other cases.
tvg::Result::NonSupport
@ NonSupport
The value returned in case of choosing unsupported engine features(options).
tvg::Result::FailedAllocation
@ FailedAllocation
The value returned in case of unsuccessful memory allocation.
tvg::Result::InvalidArguments
@ InvalidArguments
The value returned in the event of a problem with the arguments given to the API - e....
tvg::Result::MemoryCorruption
@ MemoryCorruption
The value returned in the event of bad memory handling - e.g. failing in pointer releasing or casting...
tvg::CanvasEngine::Gl
@ Gl
OpenGL rasterizer.
tvg::CanvasEngine::Sw
@ Sw
CPU rasterizer.
tvg::CanvasEngine::Wg
@ Wg
WebGPU rasterizer.
tvg::BlendMethod::SoftLight
@ SoftLight
The same as Overlay but with applying pure black or white does not result in pure black or white....
tvg::BlendMethod::Lighten
@ Lighten
Only has the opposite action of Darken Only. max(S, D)
tvg::BlendMethod::Exclusion
@ Exclusion
The result is twice the product of the top and bottom layers, subtracted from their sum....
tvg::BlendMethod::Difference
@ Difference
Subtracts the bottom layer from the top layer or the other way around, to always get a non-negative v...
tvg::BlendMethod::Saturation
@ Saturation
Reserved. Not supported.
tvg::BlendMethod::Screen
@ Screen
The values of the pixels in the two layers are inverted, multiplied, and then inverted again....
tvg::BlendMethod::Luminosity
@ Luminosity
Reserved. Not supported.
tvg::BlendMethod::Overlay
@ Overlay
Combines Multiply and Screen blend modes. (2 * S * D) if (2 * D < Da), otherwise (Sa * Da) - 2 * (Da ...
tvg::BlendMethod::Normal
@ Normal
Perform the alpha blending(default). S if (Sa == 255), otherwise (Sa * S) + (255 - Sa) * D.
tvg::BlendMethod::ColorBurn
@ ColorBurn
Divides the inverted bottom layer by the top layer, and then inverts the result. 255 - (255 - D) / S.
tvg::BlendMethod::Color
@ Color
Reserved. Not supported.
tvg::BlendMethod::HardLight
@ HardLight
The same as Overlay but with the color roles reversed. (2 * S * D) if (S < Sa), otherwise (Sa * Da) -...
tvg::BlendMethod::Multiply
@ Multiply
Takes the RGB channel values from 0 to 255 of each pixel in the top layer and multiples them with the...
tvg::BlendMethod::Add
@ Add
Simply adds pixel values of one layer with the other. (S + D)
tvg::BlendMethod::ColorDodge
@ ColorDodge
Divides the bottom layer by the inverted top layer. D / (255 - S)
tvg::BlendMethod::Darken
@ Darken
Creates a pixel that retains the smallest components of the top and bottom layer pixels....
tvg::BlendMethod::Hue
@ Hue
Reserved. Not supported.
tvg::BlendMethod::HardMix
@ HardMix
Reserved. Not supported.
tvg::Type::Shape
@ Shape
Shape class.
tvg::Type::Picture
@ Picture
Picture class.
tvg::Type::Text
@ Text
Text class.
tvg::Type::Scene
@ Scene
Scene class.
tvg::Type::Undefined
@ Undefined
Unkown class.
tvg::StrokeCap::Butt
@ Butt
The stroke ends exactly at each of the two end-points of a sub-path. For zero length sub-paths no str...
tvg::StrokeCap::Round
@ Round
The stroke is extended in both end-points of a sub-path by a half circle, with a radius equal to the ...
tvg::StrokeCap::Square
@ Square
The stroke is extended in both end-points of a sub-path by a rectangle, with the width equal to the s...
tvg::PathCommand::LineTo
@ LineTo
Draws a line from the current point to the given point and sets a new value of the current point....
tvg::PathCommand::CubicTo
@ CubicTo
Draws a cubic Bezier curve from the current point to the given point using two given control points a...
tvg::PathCommand::Close
@ Close
Ends the current sub-path and connects it with its initial point. This command doesn't expect any poi...
tvg::PathCommand::MoveTo
@ MoveTo
Sets a new initial point of the sub-path and a new current point. This command expects 1 point: the s...
tvg::SceneEffect::GaussianBlur
@ GaussianBlur
Apply a blur effect with a Gaussian filter. Param(3) = {sigma(float)[> 0], direction(int)[both: 0 / h...
tvg::SceneEffect::ClearAll
@ ClearAll
Reset all previously applied scene effects, restoring the scene to its original state.
tvg::FillRule::Winding
@ Winding
A line from the point to a location outside the shape is drawn. The intersections of the line with th...
tvg::FillRule::EvenOdd
@ EvenOdd
A line from the point to a location outside the shape is drawn and its intersections with the path se...
tvg::CompositeMethod::InvLumaMask
@ InvLumaMask
Alpha Masking using the grayscale (0.2125R + 0.7154G + 0.0721*B) of the complement to the compositing...
tvg::CompositeMethod::LumaMask
@ LumaMask
Alpha Masking using the grayscale (0.2125R + 0.7154G + 0.0721*B) of the compositing target's pixels.
tvg::CompositeMethod::InvAlphaMask
@ InvAlphaMask
Alpha Masking using the complement to the compositing target's pixels as an alpha value.
tvg::CompositeMethod::ClipPath
@ ClipPath
The intersection of the source and the target is determined and only the resulting pixels from the so...
tvg::CompositeMethod::None
@ None
No composition is applied.
tvg::CompositeMethod::DarkenMask
@ DarkenMask
Where multiple masks intersect, the lowest transparency value is used. (Experimental API)
tvg::CompositeMethod::DifferenceMask
@ DifferenceMask
Calculates the absolute difference between the target color and the source color multiplied by the co...
tvg::CompositeMethod::AddMask
@ AddMask
Combines the target and source objects pixels using target alpha. (T * TA) + (S * (255 - TA)) (Experi...
tvg::CompositeMethod::SubtractMask
@ SubtractMask
Subtracts the source color from the target color while considering their respective target alpha....
tvg::CompositeMethod::AlphaMask
@ AlphaMask
Alpha Masking using the compositing target's pixels as an alpha value.
tvg::CompositeMethod::IntersectMask
@ IntersectMask
Computes the result by taking the minimum value between the target alpha and the source alpha and mul...
tvg::CompositeMethod::LightenMask
@ LightenMask
Where multiple masks intersect, the highest transparency value is used. (Experimental API)
tvg::StrokeJoin::Bevel
@ Bevel
The outer corner of the joined path segments is bevelled at the join point. The triangular region of ...
tvg::StrokeJoin::Round
@ Round
The outer corner of the joined path segments is rounded. The circular region is centered at the join ...
tvg::StrokeJoin::Miter
@ Miter
The outer corner of the joined path segments is spiked. The spike is created by extension beyond the ...
tvg::Fill::ColorStop
A data structure storing the information about the color and its relative position inside the gradien...
Definition: thorvg.h:491
tvg::Fill::ColorStop::g
uint8_t g
Definition: thorvg.h:494
tvg::Fill::ColorStop::offset
float offset
Definition: thorvg.h:492
tvg::Fill::ColorStop::b
uint8_t b
Definition: thorvg.h:495
tvg::Fill::ColorStop::r
uint8_t r
Definition: thorvg.h:493
tvg::Fill::ColorStop::a
uint8_t a
Definition: thorvg.h:496
tvg::Matrix
A data structure representing a three-dimensional matrix.
Definition: thorvg.h:273
tvg::Point
A data structure representing a point in two-dimensional space.
Definition: thorvg.h:260