ThorVG  v0.5
Classes | Enumerations
ThorVG

ThorVG classes and enumerations providing C++ APIs. More...

Classes

struct  Point
 A data structure representing a point in two-dimensional space. More...
 
struct  Matrix
 A data structure representing a three-dimensional matrix. More...
 
class  Paint
 An abstract class for managing graphical elements. More...
 
class  Fill
 An abstract class representing the gradient fill of the Shape object. More...
 
class  Canvas
 An abstract class for drawing graphical elements. More...
 
class  LinearGradient
 A class representing the linear gradient fill of the Shape object. More...
 
class  RadialGradient
 A class representing the radial gradient fill of the Shape object. More...
 
class  Shape
 A class representing two-dimensional figures and their properties. More...
 
class  Picture
 A class representing an image read in one of the supported formats: raw, svg, png and etc. Besides the methods inherited from the Paint, it provides methods to load & draw images on the canvas. More...
 
class  Scene
 A class to composite children paints. More...
 
class  SwCanvas
 A class for the rendering graphical elements with a software raster engine. More...
 
class  GlCanvas
 A class for the rendering graphic elements with a GL raster engine. More...
 
class  Initializer
 A class that enables initialization and termination of the TVG engines. More...
 
class  Saver
 A class for exporting a paint object into a specified file, from which to recover the paint data later. More...
 

Enumerations

enum  Result {
  Success = 0, InvalidArguments, InsufficientCondition, FailedAllocation,
  MemoryCorruption, NonSupport, Unknown
}
 Enumeration specifying the result from the APIs. More...
 
enum  PathCommand { Close = 0, MoveTo, LineTo, CubicTo }
 Enumeration specifying the values of the path commands accepted by TVG. More...
 
enum  StrokeCap { Square = 0, Round, Butt }
 Enumeration determining the ending type of a stroke in the open sub-paths. More...
 
enum  StrokeJoin { Bevel = 0, Round, Miter }
 Enumeration determining the style used at the corners of joined stroked path segments. More...
 
enum  FillSpread { Pad = 0, Reflect, Repeat }
 Enumeration specifying how to fill the area outside the gradient bounds. More...
 
enum  FillRule { Winding = 0, EvenOdd }
 Enumeration specifying the algorithm used to establish which parts of the shape are treated as the inside of the shape. More...
 
enum  CompositeMethod { None = 0, ClipPath, AlphaMask, InvAlphaMask }
 Enumeration indicating the method used in the composition of two objects - the target and the source. More...
 
enum  CanvasEngine { Sw = (1 << 1), Gl = (1 << 2) }
 Enumeration specifying the engine type used for the graphics backend. For multiple backends bitwise operation is allowed. More...
 

Detailed Description

ThorVG classes and enumerations providing C++ APIs.

Enumeration Type Documentation

◆ CanvasEngine

enum CanvasEngine
strong

Enumeration specifying the engine type used for the graphics backend. For multiple backends bitwise operation is allowed.

Enumerator
Sw 

CPU rasterizer.

Gl 

OpenGL rasterizer.

◆ CompositeMethod

enum CompositeMethod
strong

Enumeration indicating the method used in the composition of two objects - the target and the source.

Enumerator
None 

No composition is applied.

ClipPath 

The intersection of the source and the target is determined and only the resulting pixels from the source are rendered.

AlphaMask 

The pixels of the source and the target are alpha blended. As a result, only the part of the source, which intersects with the target is visible.

InvAlphaMask 

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.

◆ FillRule

enum FillRule
strong

Enumeration specifying the algorithm used to establish which parts of the shape are treated as the inside of the shape.

Enumerator
Winding 

A line from the point to a location outside the shape is drawn. The intersections of the line with the path segment of the shape are counted. Starting from zero, if the path segment of the shape crosses the line clockwise, one is added, otherwise one is subtracted. If the resulting sum is non zero, the point is inside the shape.

EvenOdd 

A line from the point to a location outside the shape is drawn and its intersections with the path segments of the shape are counted. If the number of intersections is an odd number, the point is inside the shape.

◆ FillSpread

enum FillSpread
strong

Enumeration specifying how to fill the area outside the gradient bounds.

Enumerator
Pad 

The remaining area is filled with the closest stop color.

Reflect 

The gradient pattern is reflected outside the gradient area until the expected region is filled.

Repeat 

The gradient pattern is repeated continuously beyond the gradient area until the expected region is filled.

◆ PathCommand

enum PathCommand
strong

Enumeration specifying the values of the path commands accepted by TVG.

Not to be confused with the path commands from the svg path element (like M, L, Q, H and many others). TVG interprets all of them and translates to the ones from the PathCommand values.

Enumerator
Close 

Ends the current sub-path and connects it with its initial point. This command doesn't expect any points.

MoveTo 

Sets a new initial point of the sub-path and a new current point. This command expects 1 point: the starting position.

LineTo 

Draws a line from the current point to the given point and sets a new value of the current point. This command expects 1 point: the end-position of the line.

CubicTo 

Draws a cubic Bezier curve from the current point to the given point using two given control points and sets a new value of the current point. This command expects 3 points: the 1st control-point, the 2nd control-point, the end-point of the curve.

◆ Result

enum Result
strong

Enumeration specifying the result from the APIs.

Enumerator
Success 

The value returned in case of a correct request execution.

InvalidArguments 

The value returned in the event of a problem with the arguments given to the API - e.g. empty paths or null pointers.

InsufficientCondition 

The value returned in case the request cannot be processed - e.g. asking for properties of an object, which does not exist.

FailedAllocation 

The value returned in case of unsuccessful memory allocation.

MemoryCorruption 

The value returned in the event of bad memory handling - e.g. failing in pointer releasing or casting.

NonSupport 

The value returned in case of choosing unsupported options.

Unknown 

The value returned in all other cases.

◆ StrokeCap

enum StrokeCap
strong

Enumeration determining the ending type of a stroke in the open sub-paths.

Enumerator
Square 

The stroke is extended in both end-points of a sub-path by a rectangle, with the width equal to the stroke width and the length equal to the half of the stroke width. For zero length sub-paths the square is rendered with the size of the stroke width.

Round 

The stroke is extended in both end-points of a sub-path by a half circle, with a radius equal to the half of a stroke width. For zero length sub-paths a full circle is rendered.

Butt 

The stroke ends exactly at each of the two end-points of a sub-path. For zero length sub-paths no stroke is rendered.

◆ StrokeJoin

enum StrokeJoin
strong

Enumeration determining the style used at the corners of joined stroked path segments.

Enumerator
Bevel 

The outer corner of the joined path segments is bevelled at the join point. The triangular region of the corner is enclosed by a straight line between the outer corners of each stroke.

Round 

The outer corner of the joined path segments is rounded. The circular region is centered at the join point.

Miter 

The outer corner of the joined path segments is spiked. The spike is created by extension beyond the join point of the outer edges of the stroke until they intersect. In case the extension goes beyond the limit, the join style is converted to the Bevel style.