ThorVG
v0.15
|
An abstract class for managing graphical elements. More...
Public Member Functions | |
Result | rotate (float degree) noexcept |
Sets the angle by which the object is rotated. More... | |
Result | scale (float factor) noexcept |
Sets the scale value of the object. More... | |
Result | translate (float x, float y) noexcept |
Sets the values by which the object is moved in a two-dimensional space. More... | |
Result | transform (const Matrix &m) noexcept |
Sets the matrix of the affine transformation for the object. More... | |
Matrix | transform () noexcept |
Gets the matrix of the affine transformation of the object. More... | |
Result | opacity (uint8_t o) noexcept |
Sets the opacity of the object. More... | |
Result | composite (std::unique_ptr< Paint > target, CompositeMethod method) noexcept |
Sets the composition target object and the composition method. More... | |
Result | clip (std::unique_ptr< Paint > clipper) noexcept |
Clip the drawing region of the paint object. More... | |
Result | blend (BlendMethod method) noexcept |
Sets the blending method for the paint object. More... | |
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 |
Gets the axis-aligned bounding box of the paint object. More... | |
Paint * | duplicate () const noexcept |
Duplicates the object. More... | |
uint8_t | opacity () const noexcept |
Gets the opacity value of the object. More... | |
CompositeMethod | composite (const Paint **target) const noexcept |
Gets the composition target object and the composition method. More... | |
virtual Type | type () const noexcept=0 |
Returns the ID value of this class. More... | |
TVG_DEPRECATED uint32_t | identifier () const noexcept |
Public Attributes | |
uint32_t | id = 0 |
Unique ID of this instance. More... | |
An abstract class for managing graphical elements.
A graphical element in TVG is any object composed into a Canvas. Paint represents such a graphical object and its behaviors such as duplication, transformation and composition. TVG recommends the user to regard a paint as a set of volatile commands. They can prepare a Paint and then request a Canvas to run them.
|
noexcept |
Sets the blending method for the paint object.
The blending feature allows you to combine colors to create visually appealing effects, including transparency, lighting, shading, and color mixing, among others. its process involves the combination of colors or images from the source paint object with the destination (the lower layer image) using blending operations. The blending operation is determined by the chosen BlendMethod
, which specifies how the colors or images are combined.
[in] | method | The blending method to be set. |
|
noexcept |
|
noexcept |
Gets the axis-aligned bounding box of the paint object.
[out] | x | The x-coordinate of the upper-left corner of the object. |
[out] | y | The y-coordinate of the upper-left corner of the object. |
[out] | w | The width of the object. |
[out] | h | The height of the object. |
[in] | transformed | If true , the paint's transformations are taken into account in the scene it belongs to. Otherwise they aren't. |
transformed
is true
, the paint needs to be pushed into a canvas and updated before this api is called. Clip the drawing region of the paint object.
This function restricts the drawing area of the paint object to the specified shape's paths.
[in] | clipper | The shape object as the clipper. |
Result::NonSupport | If the clipper type is not Shape. |
clipper
only supports the Shape type.
|
noexcept |
Gets the composition target object and the composition method.
[out] | target | The paint of the target object. |
|
noexcept |
Sets the composition target object and the composition method.
[in] | target | The paint of the target object. |
[in] | method | The method used to composite the source object with the target. |
|
noexcept |
Duplicates the object.
Creates a new object and sets its all properties as in the original object.
nullptr
otherwise.
|
noexcept |
|
noexcept |
Gets the opacity value of the object.
|
noexcept |
Sets the opacity of the object.
[in] | o | The opacity value in the range [0 ~ 255], where 0 is completely transparent and 255 is opaque. |
|
noexcept |
Sets the angle by which the object is rotated.
The angle in measured clockwise from the horizontal axis. The rotational axis passes through the point on the object with zero coordinates.
[in] | degree | The value of the angle in degrees. |
Result::InsufficientCondition | in case a custom transform is applied. |
|
noexcept |
Sets the scale value of the object.
[in] | factor | The value of the scaling factor. The default value is 1. |
Result::InsufficientCondition | in case a custom transform is applied. |
|
noexcept |
Gets the matrix of the affine transformation of the object.
The values of the matrix can be set by the transform() API, as well by the translate(), scale() and rotate(). In case no transformation was applied, the identity matrix is returned.
Sets the matrix of the affine transformation for the object.
The augmented matrix of the transformation is expected to be given.
[in] | m | The 3x3 augmented matrix. |
|
noexcept |
Sets the values by which the object is moved in a two-dimensional space.
The origin of the coordinate system is in the upper-left corner of the canvas. The horizontal and vertical axes point to the right and down, respectively.
[in] | x | The value of the horizontal shift. |
[in] | y | The value of the vertical shift. |
Result::InsufficientCondition | in case a custom transform is applied. |
|
pure virtualnoexcept |
uint32_t id = 0 |
Unique ID of this instance.
This is reserved to specify an paint instance in a scene.