ThorVG v1.0
Loading...
Searching...
No Matches
WgCanvasfinal

A class for the rendering graphic elements with a WebGPU raster engine. More...

#include <thorvg.h>

Inheritance diagram for WgCanvas:
Collaboration diagram for WgCanvas:

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 WgCanvasgen () noexcept
 Creates a new WgCanvas object.
 

Detailed Description

A class for the rendering graphic elements with a WebGPU raster engine.

Warning
Please do not use it. This class is not fully supported yet.
Since
0.15

Member Function Documentation

◆ gen()

static WgCanvas * gen ( )
staticnoexcept

Creates a new WgCanvas object.

Returns
A new WgCanvas object.
Since
0.15

◆ target()

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.

Parameters
[in]deviceWGPUDevice, a desired handle for the wgpu device. If it is nullptr, ThorVG will assign an appropriate device internally.
[in]instanceWGPUInstance, context for all other wgpu objects.
[in]targetEither WGPUSurface or WGPUTexture, serving as handles to a presentable surface or texture.
[in]wThe width of the target.
[in]hThe height of the target.
[in]csSpecifies how the pixel values should be interpreted. Currently, it only allows ColorSpace::ABGR8888S as WGPUTextureFormat_RGBA8Unorm.
[in]type0: surface, 1: texture are used as pesentable target.
Return values
Result::InsufficientConditionif the canvas is performing rendering. Please ensure the canvas is synced.
Result::NonSupportIn case the wg engine is not supported.
Since
1.0
See also
Canvas::viewport()
Canvas::sync()