|
| const Paint * | parent () const noexcept |
| | Retrieves the parent paint object.
|
| |
| Result | visible (bool on) noexcept |
| | Sets the visibility of the Paint object.
|
| |
| Result | rotate (float degree) noexcept |
| | Sets the angle by which the object is rotated.
|
| |
| Result | scale (float factor) noexcept |
| | Sets the scale value of the object.
|
| |
| Result | translate (float x, float y) noexcept |
| | Sets the values by which the object is moved in a two-dimensional space.
|
| |
| Result | transform (const Matrix &m) noexcept |
| | Sets the matrix of the affine transformation for the object.
|
| |
| Matrix & | transform () noexcept |
| | Gets the matrix of the affine transformation of the object.
|
| |
| Result | opacity (uint8_t o) noexcept |
| | Sets the opacity of the object.
|
| |
| Result | mask (Paint *target, MaskMethod method) noexcept |
| | Sets the masking target object and the masking method.
|
| |
| Result | clip (Shape *clipper) noexcept |
| | Clip the drawing region of the paint object.
|
| |
| Result | blend (BlendMethod method) noexcept |
| | Sets the blending method for the paint object.
|
| |
| Result | bounds (Point *pt4) noexcept |
| | Retrieves the object-oriented bounding box (OBB) of the paint object in canvas space.
|
| |
| Result | bounds (float *x, float *y, float *w, float *h) noexcept |
| | Retrieves the axis-aligned bounding box (AABB) of the paint object in canvas space.
|
| |
| bool | intersects (int32_t x, int32_t y, int32_t w=1, int32_t h=1) noexcept |
| | Checks whether a given region intersects the filled area of the paint.
|
| |
| Paint * | duplicate () const noexcept |
| | Duplicates the object.
|
| |
| uint8_t | opacity () const noexcept |
| | Gets the opacity value of the object.
|
| |
| MaskMethod | mask (const Paint **target) const noexcept |
| | Gets the masking target object and the masking method.
|
| |
| Shape * | clip () const noexcept |
| | Get the clipper shape of the paint object.
|
| |
| bool | visible () const noexcept |
| | Gets the current visibility status of the Paint object.
|
| |
| uint16_t | ref () noexcept |
| | Increment the reference count for the Paint instance.
|
| |
| uint16_t | unref (bool free=true) noexcept |
| | Decrement the reference count for the Paint instance.
|
| |
| uint16_t | refCnt () const noexcept |
| | Retrieve the current reference count of the Paint instance.
|
| |
| virtual Type | type () const noexcept=0 |
| | Returns the ID value of this class.
|
| |
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.
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.
- Parameters
-
| [in] | method | The blending method to be set. |
- Since
- 1.0
| Result bounds |
( |
float * |
x, |
|
|
float * |
y, |
|
|
float * |
w, |
|
|
float * |
h |
|
) |
| |
|
noexcept |
Retrieves the axis-aligned bounding box (AABB) of the paint object in canvas space.
Returns the bounding box of the paint as an axis-aligned bounding box (AABB), with all relevant transformations applied. The returned values x, y, w, h, may have invalid if the operation fails. Thus, please check the retval.
This bounding box can be used to determine the actual rendered area of the object on the canvas, for purposes such as hit-testing, culling, or layout calculations.
- Parameters
-
| [out] | x | The x-coordinate of the upper-left corner of the bounding box. |
| [out] | y | The y-coordinate of the upper-left corner of the bounding box. |
| [out] | w | The width of the bounding box. |
| [out] | h | The height of the bounding box. |
- Return values
-
- See also
- Paint::bounds(Point* pt4)
-
Canvas::update()
Retrieves the object-oriented bounding box (OBB) of the paint object in canvas space.
This function returns the bounding box of the paint, as an oriented bounding box (OBB) after transformations are applied. The returned values pt4 may have invalid if the operation fails. Thus, please check the retval.
This bounding box can be used to obtain the transformed bounding region in canvas space by taking the geometry's axis-aligned bounding box (AABB) in the object's local coordinate space and applying the object's transformations.
- Parameters
-
| [out] | pt4 | An array of four points representing the bounding box. The array size must be 4. |
- Return values
-
- See also
- Paint::bounds(float* x, float* y, float* w, float* h)
-
Canvas::update()
- Since
- 1.0
| bool intersects |
( |
int32_t |
x, |
|
|
int32_t |
y, |
|
|
int32_t |
w = 1, |
|
|
int32_t |
h = 1 |
|
) |
| |
|
noexcept |
Checks whether a given region intersects the filled area of the paint.
This function determines whether the specified rectangular region—defined by (x, y, w, h)— intersects the geometric fill region of the paint object.
This is useful for hit-testing purposes, such as detecting whether a user interaction (e.g., touch or click) occurs within a painted region.
The paint must be updated in a Canvas beforehand—typically after the Canvas has been drawn and synchronized.
- Parameters
-
| [in] | x | The x-coordinate of the top-left corner of the test region. |
| [in] | y | The y-coordinate of the top-left corner of the test region. |
| [in] | w | The width of the region to test. Must be greater than 0; defaults to 1. |
| [in] | h | The height of the region to test. Must be greater than 0; defaults to 1. |
- Returns
true if any part of the region intersects the filled area; otherwise, false.
- Note
- To test a single point, set the region size to w = 1, h = 1.
-
For efficiency, an AABB (axis-aligned bounding box) test is performed internally before precise hit detection.
-
This test does not take into account the results of blending or masking.
-
This test does take into account the the hidden paints as well.
- See also
- Paint::visible()
- Since
- 1.0