Top | ![]() |
![]() |
![]() |
![]() |
GdkSurface * | gsk_renderer_get_surface () |
gboolean | gsk_renderer_realize () |
void | gsk_renderer_unrealize () |
gboolean | gsk_renderer_is_realized () |
void | gsk_renderer_render () |
GdkTexture * | gsk_renderer_render_texture () |
GskRenderer * | gsk_renderer_new_for_surface () |
GskRenderer * | gsk_gl_renderer_new () |
GskRenderer * | gsk_cairo_renderer_new () |
GskRenderer * | gsk_vulkan_renderer_new () |
GskRenderer * | gsk_broadway_renderer_new () |
GskRenderer is a class that renders a scene graph defined via a tree of GskRenderNode instances.
Typically you will use a GskRenderer instance to repeatedly call
gsk_renderer_render()
to update the contents of its associated GdkSurface.
It is necessary to realize a GskRenderer instance using gsk_renderer_realize()
before calling gsk_renderer_render()
, in order to create the appropriate
windowing system resources needed to render the scene.
GdkSurface *
gsk_renderer_get_surface (GskRenderer *renderer
);
Retrieves the GdkSurface set using gsk_renderer_realize()
. If the renderer
has not been realized yet, NULL
will be returned.
gboolean gsk_renderer_realize (GskRenderer *renderer
,GdkSurface *surface
,GError **error
);
Creates the resources needed by the renderer
to render the scene
graph.
renderer |
||
surface |
the GdkSurface renderer will be used on |
|
error |
return location for an error |
void
gsk_renderer_unrealize (GskRenderer *renderer
);
Releases all the resources created by gsk_renderer_realize()
.
gboolean
gsk_renderer_is_realized (GskRenderer *renderer
);
Checks whether the renderer
is realized or not.
void gsk_renderer_render (GskRenderer *renderer
,GskRenderNode *root
,const cairo_region_t *region
);
Renders the scene graph, described by a tree of GskRenderNode instances,
ensuring that the given region
gets redrawn.
Renderers must ensure that changes of the contents given by the root
node as well as the area given by region
are redrawn. They are however
free to not redraw any pixel outside of region
if they can guarantee that
it didn't change.
The renderer
will acquire a reference on the GskRenderNode tree while
the rendering is in progress.
renderer |
||
root |
||
region |
the cairo_region_t that must be redrawn or |
[nullable] |
GdkTexture * gsk_renderer_render_texture (GskRenderer *renderer
,GskRenderNode *root
,const graphene_rect_t *viewport
);
Renders the scene graph, described by a tree of GskRenderNode instances, to a GdkTexture.
The renderer
will acquire a reference on the GskRenderNode tree while
the rendering is in progress.
If you want to apply any transformations to root
, you should put it into a
transform node and pass that node instead.
renderer |
a realized GdkRenderer |
|
root |
||
viewport |
the section to draw or |
[allow-none] |
GskRenderer *
gsk_renderer_new_for_surface (GdkSurface *surface
);
Creates an appropriate GskRenderer instance for the given surface
.
The renderer will be realized when it is returned.
GskRenderer *
gsk_gl_renderer_new (void
);
Creates a new GskRenderer using OpenGL. This is the default renderer used by GTK.
GskRenderer *
gsk_cairo_renderer_new (void
);
Creates a new Cairo renderer.
The Cairo renderer is the fallback renderer drawing in ways similar to how GTK 3 drew its content. Its primary use is as comparison tool.
The Cairo renderer is incomplete. It cannot render 3D transformed content and will instead render an error marker. Its usage should be avoided.
GskRenderer *
gsk_vulkan_renderer_new (void
);
Creates a new Vulkan renderer.
The Vulkan renderer is a renderer that uses the Vulkan library for rendering.
This function is only available when GTK was compiled with Vulkan support.
GskRenderer *
gsk_broadway_renderer_new (void
);
Creates a new Broadway renderer.
The Broadway renderer is the default renderer for the broadway backend.
It will only work with broadway surfaces, otherwise it will fail the
call to gdk_renderer_realize()
.
This function is only available when GTK was compiled with Broadway support.
“realized”
property “realized” gboolean
The renderer has been associated with a surface.
Owner: GskRenderer
Flags: Read
Default value: FALSE
“surface”
property“surface” GdkSurface *
The surface associated to the renderer.
Owner: GskRenderer
Flags: Read