![]() |
ThorVG v1.0
|
A class for the rendering graphical elements with a software raster engine. More...
#include <thorvg.h>


Public Member Functions | |
| Result | target (uint32_t *buffer, uint32_t stride, uint32_t w, uint32_t h, ColorSpace cs) noexcept |
| Sets the drawing target for the rasterization. | |
Public Member Functions inherited from Canvas | |
| const std::list< Paint * > & | paints () const noexcept |
| Returns the list of paints currently held by the Canvas. | |
| Result | push (Paint *target, Paint *at=nullptr) noexcept |
| Adds a paint object to the root scene. | |
| Result | remove (Paint *paint=nullptr) noexcept |
| Removes a paint object or all paint objects from the root scene. | |
| Result | update () noexcept |
| Requests the canvas to update modified paint objects in preparation for rendering. | |
| Result | draw (bool clear=false) noexcept |
| Requests the canvas to render the Paint objects. | |
| Result | viewport (int32_t x, int32_t y, int32_t w, int32_t h) noexcept |
| Sets the drawing region of the canvas. | |
| Result | sync () noexcept |
| Guarantees that drawing task is finished. | |
Static Public Member Functions | |
| static SwCanvas * | gen (EngineOption op=EngineOption::Default) noexcept |
| Creates a new SwCanvas object with optional rendering engine settings. | |
A class for the rendering graphical elements with a software raster engine.
|
staticnoexcept |
Creates a new SwCanvas object with optional rendering engine settings.
This method generates a software canvas instance that can be used for drawing vector graphics. It accepts an optional parameter op to choose between different rendering engine behaviors.
| [in] | op | The rendering engine option. Default is EngineOption::Default. |
|
noexcept |
Sets the drawing target for the rasterization.
The buffer of a desirable size should be allocated and owned by the caller.
| [in] | buffer | A pointer to a memory block of the size stride x h, where the raster data are stored. |
| [in] | stride | The stride of the raster image - greater than or equal to w. |
| [in] | w | The width of the raster image. |
| [in] | h | The height of the raster image. |
| [in] | cs | The value specifying the way the 32-bits colors should be read/written. |
| Result::InvalidArguments | In case no valid pointer is provided or the width, or the height or the stride is zero. |
| Result::InsufficientCondition | if the canvas is performing rendering. Please ensure the canvas is synced. |
| Result::NonSupport | In case the software engine is not supported. |
buffer during Canvas::push() - Canvas::sync(). It should not be accessed while the engine is writing on it.