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


Public Member Functions | |
| Result | target (void *device, void *instance, void *target, uint32_t w, uint32_t h, ColorSpace cs, int type=0) 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 WgCanvas * | gen () noexcept |
| Creates a new WgCanvas object. | |
A class for the rendering graphic elements with a WebGPU raster engine.
|
staticnoexcept |
|
noexcept |
Sets the drawing target for the rasterization.
| [in] | device | WGPUDevice, a desired handle for the wgpu device. If it is nullptr, ThorVG will assign an appropriate device internally. |
| [in] | instance | WGPUInstance, context for all other wgpu objects. |
| [in] | target | Either WGPUSurface or WGPUTexture, serving as handles to a presentable surface or texture. |
| [in] | w | The width of the target. |
| [in] | h | The height of the target. |
| [in] | cs | Specifies how the pixel values should be interpreted. Currently, it only allows ColorSpace::ABGR8888S as WGPUTextureFormat_RGBA8Unorm. |
| [in] | type | 0: surface, 1: texture are used as pesentable target. |
| Result::InsufficientCondition | if the canvas is performing rendering. Please ensure the canvas is synced. |
| Result::NonSupport | In case the wg engine is not supported. |