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


Classes | |
| struct | Context |
| Encapsulates the WebGPU context required for rendering. More... | |
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. | |
| Result | target (const Context &context, 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 | add (Paint *target, Paint *at=nullptr) noexcept |
| Adds a paint object to the canvas 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 (EngineOption op=EngineOption::Default) noexcept |
| Creates a new WebGPU Canvas object with optional rendering engine settings. | |
A class for the rendering graphic elements with a WebGPU raster engine.
|
staticnoexcept |
Creates a new WebGPU Canvas object with optional rendering engine settings.
This method generates a WebGPU 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. |
EngineOption::SmartRender. The request will be ignored.
|
noexcept |
Sets the drawing target for the rasterization.
| [in] | context | WebGPU context. |
| [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 allows ColorSpace::ABGR8888 and ColorSpace::ABGR8888S. |
| [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. |
|
noexcept |
Sets the drawing target for the rasterization.
| [in] | device | WGPUDevice, a desired handle for the wgpu device. |
| [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 allows ColorSpace::ABGR8888 and ColorSpace::ABGR8888S. |
| [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. |
cs, this target API uses the default alpha mode.