![]() |
![]() |
![]() |
![]() |
GdkDisplay * | display | Read / Write / Construct Only |
GdkDrawingContext * | drawing-context | Read |
gint | scale-factor | Read / Write |
GrapheneRect * | viewport | Read / Write |
GdkWindow * | window | Read |
GskRenderer is a class that renders a scene graph defined via a tree of GskRenderNode instances.
Typically you will use a GskRenderer instance with a GdkDrawingContext
associated to a GdkWindow, and call gsk_renderer_render()
with the
drawing context and the scene to be rendered.
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.
GskRenderer *
gsk_renderer_new_for_window (GdkWindow *window
);
Creates an appropriate GskRenderer instance for the given window
.
The renderer will be realized when it is returned.
Since: 3.90
void gsk_renderer_set_viewport (GskRenderer *renderer
,const graphene_rect_t *viewport
);
Sets the visible rectangle to be used as the viewport for the rendering.
Since: 3.90
void gsk_renderer_get_viewport (GskRenderer *renderer
,graphene_rect_t *viewport
);
Retrieves the viewport of the GskRenderer.
Since: 3.90
void gsk_renderer_set_scale_factor (GskRenderer *renderer
,int scale_factor
);
Sets the scale factor for the renderer.
Since: 3.90
int
gsk_renderer_get_scale_factor (GskRenderer *renderer
);
Gets the scale factor for the renderer
.
Since: 3.90
GdkWindow *
gsk_renderer_get_window (GskRenderer *renderer
);
Retrieves the GdkWindow set using gsk_renderer_realize()
. If the renderer
has not been realized yet, NULL
will be returned.
Since: 3.90
GdkDisplay *
gsk_renderer_get_display (GskRenderer *renderer
);
Retrieves the GdkDisplay used when creating the GskRenderer.
Since: 3.90
gboolean gsk_renderer_realize (GskRenderer *renderer
,GdkWindow *window
,GError **error
);
Creates the resources needed by the renderer
to render the scene
graph.
renderer |
||
window |
the GdkWindow renderer will be used on |
|
error |
return location for an error |
Since: 3.90
void
gsk_renderer_unrealize (GskRenderer *renderer
);
Releases all the resources created by gsk_renderer_realize()
.
Since: 3.90
GdkDrawingContext * gsk_renderer_begin_draw_frame (GskRenderer *renderer
,const cairo_region_t *region
);
Indicates that you are beginning the process of redrawing region
using
renderer
, and provides you with a GdkDrawingContext to use for this.
a GdkDrawingContext context that should be used to
draw the contents of the renderer
. This context is owned by GDK.
[transfer none]
Since: 3.90
void gsk_renderer_end_draw_frame (GskRenderer *renderer
,GdkDrawingContext *context
);
Release the drawning context returned by gsk_renderer_begin_draw_frame()
.
Calls to gsk_renderer_begin_draw_frame()
and gsk_renderer_end_draw_frame()
must be paired.
renderer |
||
context |
the drawing context returned by the matching call to
|
Since: 3.90
void gsk_renderer_render (GskRenderer *renderer
,GskRenderNode *root
,GdkDrawingContext *context
);
Renders the scene graph, described by a tree of GskRenderNode instances, using the given GdkDrawingContext.
The renderer
will acquire a reference on the GskRenderNode tree while
the rendering is in progress.
Since: 3.90
GskTexture * 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 GskTexture.
The renderer
will acquire a reference on the GskRenderNode tree while
the rendering is in progress, and will make the tree immutable.
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] |
Since: 3.90
“display”
property“display” GdkDisplay *
The GdkDisplay used by the GskRenderer.
Flags: Read / Write / Construct Only
Since: 3.90
“drawing-context”
property“drawing-context” GdkDrawingContext *
The drawing context used when rendering.
Flags: Read
Since: 3.90
“scale-factor”
property“scale-factor” gint
The scale factor used when rendering.
Flags: Read / Write
Allowed values: >= 1
Default value: 1
Since: 3.90
“viewport”
property“viewport” GrapheneRect *
The visible area used by the GskRenderer to render its contents.
Flags: Read / Write
Since: 3.90