Top | ![]() |
![]() |
![]() |
![]() |
GskRenderNode is the basic block in a scene graph to be rendered using GskRenderer.
Each node has a parent, except the top-level node; each node may have children nodes.
Each node has an associated drawing surface, which has the size of
the rectangle set using gsk_render_node_set_bounds()
. Nodes have an
associated transformation matrix, which is used to position and
transform the node on the scene graph; additionally, they also have
a child transformation matrix, which will be applied to each child.
Render nodes are meant to be transient; once they have been associated to a GskRenderer it's safe to release any reference you have on them. All GskRenderNodes are immutable, you can only specify their properties during construction.
GskRenderNode *
gsk_render_node_ref (GskRenderNode *node
);
Acquires a reference on the given GskRenderNode.
Since: 3.90
void
gsk_render_node_unref (GskRenderNode *node
);
Releases a reference on the given GskRenderNode.
If the reference was the last, the resources associated to the node
are
freed.
Since: 3.90
GskRenderNodeType
gsk_render_node_get_node_type (GskRenderNode *node
);
Returns the type of the node
.
Since: 3.90
void gsk_render_node_draw (GskRenderNode *node
,cairo_t *cr
);
Draw the contents of node
to the given cairo context.
Typically, you'll use this function to implement fallback rendering of GskRenderNodes on an intermediate Cairo context, instead of using the drawing context associated to a GdkWindow's rendering buffer.
For advanced nodes that cannot be supported using Cairo, in particular for nodes doing 3D operations, this function may fail.
void gsk_render_node_set_name (GskRenderNode *node
,const char *name
);
Sets the name of the node.
A name is generally useful for debugging purposes.
Since: 3.90
GskRenderNode * gsk_color_node_new (const GdkRGBA *rgba
,const graphene_rect_t *bounds
);
Creates a GskRenderNode that will render the given
color
into the area given by bounds
.
Since: 3.90
GskRenderNode * gsk_linear_gradient_node_new (const graphene_rect_t *bounds
,const graphene_point_t *start
,const graphene_point_t *end
,const GskColorStop *color_stops
,gsize n_color_stops
);
Creates a GskRenderNode that will render the given
linear_gradient
into the area given by bounds
.
linear_gradient |
the GskLinearGradient |
|
bounds |
the rectangle to render the linear_gradient into |
Since: 3.90
GskRenderNode * gsk_repeating_linear_gradient_node_new (const graphene_rect_t *bounds
,const graphene_point_t *start
,const graphene_point_t *end
,const GskColorStop *color_stops
,gsize n_color_stops
);
GskRenderNode * gsk_border_node_new (const GskRoundedRect *outline
,const float border_width[4]
,const GdkRGBA border_color[4]
);
Creates a GskRenderNode that will stroke a border rectangle inside the
given outline
. The 4 sides of the border can have different widths and
colors.
outline |
a GskRoundedRect describing the outline of the border |
|
border_width |
the stroke width of the border on the top, right, bottom and left side respectively. |
|
border_color |
the color used on the top, right, bottom and left side. |
Since: 3.90
GskRenderNode * gsk_texture_node_new (GskTexture *texture
,const graphene_rect_t *bounds
);
Creates a GskRenderNode that will render the given
texture
into the area given by bounds
.
Since: 3.90
GskRenderNode * gsk_inset_shadow_node_new (const GskRoundedRect *outline
,const GdkRGBA *color
,float dx
,float dy
,float spread
,float blur_radius
);
Creates a GskRenderNode that will render an inset shadow
into the box given by outline
.
outline |
outline of the region containing the shadow |
|
color |
color of the shadow |
|
dx |
horizontal offset of shadow |
|
dy |
vertical offset of shadow |
|
spread |
how far the shadow spreads towards the inside |
|
blur_radius |
how much blur to apply to the shadow |
Since: 3.90
GskRenderNode * gsk_outset_shadow_node_new (const GskRoundedRect *outline
,const GdkRGBA *color
,float dx
,float dy
,float spread
,float blur_radius
);
Creates a GskRenderNode that will render an outset shadow
around the box given by outline
.
outline |
outline of the region surrounded by shadow |
|
color |
color of the shadow |
|
dx |
horizontal offset of shadow |
|
dy |
vertical offset of shadow |
|
spread |
how far the shadow spreads towards the inside |
|
blur_radius |
how much blur to apply to the shadow |
Since: 3.90
GskRenderNode *
gsk_cairo_node_new (const graphene_rect_t *bounds
);
Creates a GskRenderNode that will render a cairo surface
into the area given by bounds
. You can draw to the cairo
surface using gsk_cairo_node_get_draw_context()
Since: 3.90
cairo_t * gsk_cairo_node_get_draw_context (GskRenderNode *node
,GskRenderer *renderer
);
Creates a Cairo context for drawing using the surface associated
to the render node.
If no surface exists yet, a surface will be created optimized for
rendering to renderer
.
Since: 3.90
GskRenderNode * gsk_container_node_new (GskRenderNode **children
,guint n_children
);
Creates a new GskRenderNode instance for holding the given children
.
The new node will acquire a reference to each of the children.
children |
The children of the node. |
[array length=n_children][transfer none] |
n_children |
Number of children in the |
Since: 3.90
guint
gsk_container_node_get_n_children (GskRenderNode *node
);
Retrieves the number of direct children of node
.
Since: 3.90
GskRenderNode * gsk_container_node_get_child (GskRenderNode *node
,guint idx
);
GskRenderNode * gsk_transform_node_new (GskRenderNode *child
,const graphene_matrix_t *transform
);
Creates a GskRenderNode that will transform the given child
with the given transform
.
Since: 3.90
GskRenderNode *
gsk_transform_node_get_child (GskRenderNode *node
);
Gets the child node that is getting transformed by the given node
.
GskRenderNode * gsk_opacity_node_new (GskRenderNode *child
,double opacity
);
Creates a GskRenderNode that will drawn the child
with reduced
opacity
.
Since: 3.90
GskRenderNode *
gsk_opacity_node_get_child (GskRenderNode *node
);
Gets the child node that is getting opacityed by the given node
.
GskRenderNode * gsk_clip_node_new (GskRenderNode *child
,const graphene_rect_t *clip
);
Creates a GskRenderNode that will clip the child
to the area
given by clip
.
Since: 3.90
GskRenderNode *
gsk_clip_node_get_child (GskRenderNode *node
);
Gets the child node that is getting clipped by the given node
.
GskRenderNode * gsk_rounded_clip_node_new (GskRenderNode *child
,const GskRoundedRect *clip
);
Creates a GskRenderNode that will clip the child
to the area
given by clip
.
Since: 3.90
GskRenderNode *
gsk_rounded_clip_node_get_child (GskRenderNode *node
);
Gets the child node that is getting clipped by the given node
.
GskRenderNode * gsk_shadow_node_new (GskRenderNode *child
,const GskShadow *shadows
,gsize n_shadows
);
Creates a GskRenderNode that will draw a child
with the given
shadows
below it.
child |
The node to draw |
|
shadows |
The shadows to apply. |
[array length=n_shadows] |
n_shadows |
number of entries in the |
Since: 3.90
GskRenderNode * gsk_blend_node_new (GskRenderNode *bottom
,GskRenderNode *top
,GskBlendMode blend_mode
);
Creates a GskRenderNode that will use blend_mode
to blend the top
node onto the bottom
node.
bottom |
The bottom node to be drawn |
|
top |
The node to be blended onto the |
|
blend_mode |
The blend mode to use |
Since: 3.90
GskRenderNode * gsk_cross_fade_node_new (GskRenderNode *start
,GskRenderNode *end
,double progress
);
Creates a GskRenderNode that will do a cross-fade between start
and end
.
start |
The start node to be drawn |
|
end |
The node to be cross_fadeed onto the |
|
progress |
How far the fade has progressed from start to end. The value will be clamped to the range [0 ... 1] |
Since: 3.90
The type of a node determines what the node is rendering.
Error type. No node will ever have this type. |
||
A node containing a stack of children |
||
A node drawing a cairo_surface_t |
||
A node drawing a single color rectangle |
||
A node drawing a linear gradient |
||
A node drawing a repeating linear gradient |
||
A node stroking a border around an area |
||
A node drawing a GskTexture |
||
A node drawing an inset shadow |
||
A node drawing an outset shadow |
||
A node that renders its child after applying a matrix transform |
||
A node that changes the opacity of its child |
||
A node that clips its child to a rectangular area |
||
A node that clips its child to a rounded rectangle |
||
A node that draws a shadow below its child |
||
A node the blends two children together |
||
A node the cross-fades between two children |
Since: 3.90
The filters used when scaling texture data.
The actual implementation of each filter is deferred to the rendering pipeline.
Since: 3.90
struct GskShadow { GdkRGBA color; float dx; float dy; float spread; float radius; };
The blend modes available for render nodes.
The implementation of each blend mode is deferred to the rendering pipeline.
The default blend mode, which specifies no blending |
||
The source color is multiplied by the destination and replaces the destination |
||
... |
||
... |
||
... |
||
... |
||
... |
||
... |
||
... |
||
... |
||
... |
||
... |
||
... |
||
... |
||
... |
||
... |
Since: 3.90