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

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

#include <thorvg.h>

Inheritance diagram for GlCanvas:
Collaboration diagram for GlCanvas:

Public Member Functions

Result target (void *display, void *surface, void *context, int32_t id, uint32_t w, uint32_t h, ColorSpace cs) noexcept
 Sets the drawing target for 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 GlCanvasgen () noexcept
 Creates a new GlCanvas object.
 

Detailed Description

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

Since
0.14

Member Function Documentation

◆ gen()

static GlCanvas * gen ( )
staticnoexcept

Creates a new GlCanvas object.

Returns
A new GlCanvas object.
Since
0.14

◆ target()

Result target ( void *  display,
void *  surface,
void *  context,
int32_t  id,
uint32_t  w,
uint32_t  h,
ColorSpace  cs 
)
noexcept

Sets the drawing target for rasterization.

This function specifies the drawing target where the rasterization will occur. It can target a specific framebuffer object (FBO) or the main surface.

Parameters
[in]displayThe platform-specific display handle (EGLDisplay for EGL). Set nullptr for other systems.
[in]surfaceThe platform-specific surface handle (EGLSurface for EGL, HDC for WGL). Set nullptr for other systems.
[in]contextThe OpenGL context to be used for rendering on this canvas.
[in]idThe GL target ID, usually indicating the FBO ID. A value of 0 specifies the main surface.
[in]wThe width (in pixels) of the raster image.
[in]hThe height (in pixels) of the raster image.
[in]csSpecifies how the pixel values should be interpreted. Currently, it only allows ColorSpace::ABGR8888S as GL_RGBA8.
Return values
Result::InsufficientConditionIf the canvas is currently rendering. Ensure that Canvas::sync() has been called before setting a new target.
Result::NonSupportIn case the gl engine is not supported.
Note
If display and surface are not provided, the ThorVG GL engine assumes that the appropriate OpenGL context is already current and will not attempt to bind a new one.
See also
Canvas::sync()
Since
1.0