GskRenderer

GskRenderer — Renders a scene

Properties

GdkDisplay * display Read / Write / Construct Only
GdkSurface * surface Read

Object Hierarchy

    GObject
    ╰── GskRenderer

Description

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.

Functions

gsk_renderer_new_for_surface ()

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.

Parameters

surface

a GdkSurface

 

gsk_renderer_get_surface ()

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.

Parameters

renderer

a GskRenderer

 

gsk_renderer_get_display ()

GdkDisplay *
gsk_renderer_get_display (GskRenderer *renderer);

Retrieves the GdkDisplay used when creating the GskRenderer.

Parameters

renderer

a GskRenderer

 

Returns

a GdkDisplay.

[transfer none]


gsk_renderer_realize ()

gboolean
gsk_renderer_realize (GskRenderer *renderer,
                      GdkSurface *surface,
                      GError **error);

Creates the resources needed by the renderer to render the scene graph.

Parameters

renderer

a GskRenderer

 

surface

the GdkSurface renderer will be used on

 

error

return location for an error

 

gsk_renderer_unrealize ()

void
gsk_renderer_unrealize (GskRenderer *renderer);

Releases all the resources created by gsk_renderer_realize().

Parameters

renderer

a GskRenderer

 

gsk_renderer_render ()

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.

Parameters

renderer

a GskRenderer

 

root

a GskRenderNode

 

region

the cairo_region_t that must be redrawn or NULL for the whole window

 

gsk_renderer_render_texture ()

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.

Parameters

renderer

a realized GdkRenderer

 

root

a GskRenderNode

 

viewport

the section to draw or NULL to use root 's bounds.

[allow-none]

Returns

a GdkTexture with the rendered contents of root .

[transfer full]

Types and Values

Property Details

The “display” property

  “display”                  GdkDisplay *

The GdkDisplay used by the GskRenderer.

Flags: Read / Write / Construct Only


The “surface” property

  “surface”                  GdkSurface *

The surface associated to the renderer.

Flags: Read