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()
.
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.
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.
GskRenderNodeType
gsk_render_node_get_node_type (GskRenderNode *node
);
Returns the type of the node
.
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 GdkSurface's rendering buffer.
For advanced nodes that cannot be supported using Cairo, in particular for nodes doing 3D operations, this function may fail.
void (*GskParseErrorFunc) (const GtkCssSection *section
,const GError *error
,gpointer user_data
);
The type of callback that is called when a parse error occurs during deserialization of node data.
GBytes *
gsk_render_node_serialize (GskRenderNode *node
);
Serializes the node
for later deserialization via
gsk_render_node_deserialize()
. No guarantees are made about the format
used other than that the same version of GTK+ will be able to deserialize
the result of a call to gsk_render_node_serialize()
and
gsk_render_node_deserialize()
will correctly reject files it cannot open
that were created with previous versions of GTK+.
The intended use of this functions is testing, benchmarking and debugging. The format is not meant as a permanent storage format.
GskRenderNode * gsk_render_node_deserialize (GBytes *bytes
,GskParseErrorFunc error_func
,gpointer user_data
);
Loads data previously created via gsk_render_node_serialize()
. For a
discussion of the supported format, see that function.
gboolean gsk_render_node_write_to_file (GskRenderNode *node
,const char *filename
,GError **error
);
This function is equivalent to calling gsk_render_node_serialize()
followed by g_file_set_contents()
. See those two functions for details
on the arguments.
It is mostly intended for use inside a debugger to quickly dump a render node to a file for later inspection.
void gsk_render_node_get_bounds (GskRenderNode *node
,graphene_rect_t *bounds
);
Retrieves the boundaries of the node
. The node will not draw outside
of its boundaries.
GskRenderNode * gsk_color_node_new (const GdkRGBA *rgba
,const graphene_rect_t *bounds
);
Creates a GskRenderNode that will render the color specified by rgba
into
the area given by bounds
.
const GdkRGBA *
gsk_color_node_peek_color (GskRenderNode *node
);
Retrieves the color of the given node
.
GskRenderNode * gsk_texture_node_new (GdkTexture *texture
,const graphene_rect_t *bounds
);
Creates a GskRenderNode that will render the given
texture
into the area given by bounds
.
GdkTexture *
gsk_texture_node_get_texture (GskRenderNode *node
);
Retrieves the GdkTexture used when creating this GskRenderNode.
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 create a linear gradient from the given
points and color stops, and render that into the area given by bounds
.
bounds |
the rectangle to render the linear gradient into |
|
start |
the point at which the linear gradient will begin |
|
end |
the point at which the linear gradient will finish |
|
color_stops |
a pointer to an array of GskColorStop defining the gradient. |
[array length=n_color_stops] |
n_color_stops |
the number of elements in |
const graphene_point_t *
gsk_linear_gradient_node_peek_start (GskRenderNode *node
);
Retrieves the initial point of the linear gradient.
const graphene_point_t *
gsk_linear_gradient_node_peek_end (GskRenderNode *node
);
Retrieves the final point of the linear gradient.
gsize
gsk_linear_gradient_node_get_n_color_stops
(GskRenderNode *node
);
Retrieves the number of color stops in the gradient.
const GskColorStop * gsk_linear_gradient_node_peek_color_stops (GskRenderNode *node
,gsize *n_stops
);
Retrievs the color stops in the gradient.
node |
a GskRenderNode for a linear gradient. |
[type GskLinearGradientNode] |
n_stops |
the number of color stops in the returned array. |
[out][optional] |
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
);
Creates a GskRenderNode that will create a repeating linear gradient
from the given points and color stops, and render that into the area
given by bounds
.
bounds |
the rectangle to render the linear gradient into |
|
start |
the point at which the linear gradient will begin |
|
end |
the point at which the linear gradient will finish |
|
color_stops |
a pointer to an array of GskColorStop defining the gradient. |
[array length=n_color_stops] |
n_color_stops |
the number of elements in |
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. |
[array fixed-size=4] |
border_color |
the color used on the top, right, bottom and left side. |
[array fixed-size=4] |
const GskRoundedRect *
gsk_border_node_peek_outline (GskRenderNode *node
);
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
.
const GskRoundedRect *
gsk_inset_shadow_node_peek_outline (GskRenderNode *node
);
Retrieves the outline rectangle of the inset shadow.
const GdkRGBA *
gsk_inset_shadow_node_peek_color (GskRenderNode *node
);
Retrieves the color of the inset shadow.
float
gsk_inset_shadow_node_get_dx (GskRenderNode *node
);
Retrieves the horizontal offset of the inset shadow.
float
gsk_inset_shadow_node_get_dy (GskRenderNode *node
);
Retrieves the vertical offset of the inset shadow.
float
gsk_inset_shadow_node_get_spread (GskRenderNode *node
);
Retrieves how much the shadow spreads inwards.
float
gsk_inset_shadow_node_get_blur_radius (GskRenderNode *node
);
Retrieves the blur radius to apply to the shadow.
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
.
const GskRoundedRect *
gsk_outset_shadow_node_peek_outline (GskRenderNode *node
);
Retrieves the outline rectangle of the outset shadow.
const GdkRGBA *
gsk_outset_shadow_node_peek_color (GskRenderNode *node
);
Retrieves the color of the outset shadow.
float
gsk_outset_shadow_node_get_dx (GskRenderNode *node
);
Retrieves the horizontal offset of the outset shadow.
float
gsk_outset_shadow_node_get_dy (GskRenderNode *node
);
Retrieves the vertical offset of the outset shadow.
float
gsk_outset_shadow_node_get_spread (GskRenderNode *node
);
Retrieves how much the shadow spreads outwards.
float
gsk_outset_shadow_node_get_blur_radius
(GskRenderNode *node
);
Retrieves the blur radius of the shadow.
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()
cairo_t *
gsk_cairo_node_get_draw_context (GskRenderNode *node
);
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
.
cairo_surface_t *
gsk_cairo_node_peek_surface (GskRenderNode *node
);
Retrieves the Cairo surface used by the render node.
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.
guint
gsk_container_node_get_n_children (GskRenderNode *node
);
Retrieves the number of direct children of node
.
GskRenderNode * gsk_container_node_get_child (GskRenderNode *node
,guint idx
);
Gets one of the children of container
.
node |
a container GskRenderNode. |
[type GskContainerNode] |
idx |
the position of the child to get |
GskRenderNode * gsk_transform_node_new (GskRenderNode *child
,GskTransform *transform
);
Creates a GskRenderNode that will transform the given child
with the given transform
.
GskRenderNode *
gsk_transform_node_get_child (GskRenderNode *node
);
Gets the child node that is getting transformed by the given node
.
GskTransform *
gsk_transform_node_get_transform (GskRenderNode *node
);
Retrieves the GskTransform used by the node
.
GskRenderNode * gsk_opacity_node_new (GskRenderNode *child
,float opacity
);
Creates a GskRenderNode that will drawn the child
with reduced
opacity
.
GskRenderNode *
gsk_opacity_node_get_child (GskRenderNode *node
);
Gets the child node that is getting opacityed by the given node
.
float
gsk_opacity_node_get_opacity (GskRenderNode *node
);
Gets the transparency factor for an opacity node.
GskRenderNode * gsk_color_matrix_node_new (GskRenderNode *child
,const graphene_matrix_t *color_matrix
,const graphene_vec4_t *color_offset
);
Creates a GskRenderNode that will drawn the child
with reduced
color_matrix
.
In particular, the node will transform the operation
1 |
pixel = color_matrix * pixel + color_offset |
for every pixel.
GskRenderNode *
gsk_color_matrix_node_get_child (GskRenderNode *node
);
Gets the child node that is getting its colors modified by the given node
.
const graphene_matrix_t *
gsk_color_matrix_node_peek_color_matrix
(GskRenderNode *node
);
Retrieves the color matrix used by the node
.
const graphene_vec4_t *
gsk_color_matrix_node_peek_color_offset
(GskRenderNode *node
);
Retrieves the color offset used by the node
.
GskRenderNode * gsk_repeat_node_new (const graphene_rect_t *bounds
,GskRenderNode *child
,const graphene_rect_t *child_bounds
);
Creates a GskRenderNode that will repeat the drawing of child
across
the given bounds
.
GskRenderNode *
gsk_repeat_node_get_child (GskRenderNode *node
);
Retrieves the child of node
.
const graphene_rect_t *
gsk_repeat_node_peek_child_bounds (GskRenderNode *node
);
Retrieves the bounding rectangle of the child of 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
.
GskRenderNode *
gsk_clip_node_get_child (GskRenderNode *node
);
Gets the child node that is getting clipped by the given node
.
const graphene_rect_t *
gsk_clip_node_peek_clip (GskRenderNode *node
);
Retrieves the clip rectangle for 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
.
GskRenderNode *
gsk_rounded_clip_node_get_child (GskRenderNode *node
);
Gets the child node that is getting clipped by the given node
.
const GskRoundedRect *
gsk_rounded_clip_node_peek_clip (GskRenderNode *node
);
Retrievs the rounded rectangle used to clip the contents of the 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.
const GskShadow * gsk_shadow_node_peek_shadow (GskRenderNode *node
,gsize i
);
Retrieves the shadow data at the given index i
.
gsize
gsk_shadow_node_get_n_shadows (GskRenderNode *node
);
Retrieves the number of shadows in the node
.
GskRenderNode *
gsk_shadow_node_get_child (GskRenderNode *node
);
Retrieves the child GskRenderNode of the shadow node
.
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.
GskRenderNode *
gsk_blend_node_get_bottom_child (GskRenderNode *node
);
Retrieves the bottom GskRenderNode child of the node
.
GskRenderNode *
gsk_blend_node_get_top_child (GskRenderNode *node
);
Retrieves the top GskRenderNode child of the node
.
GskBlendMode
gsk_blend_node_get_blend_mode (GskRenderNode *node
);
Retrieves the blend mode used by node
.
GskRenderNode * gsk_cross_fade_node_new (GskRenderNode *start
,GskRenderNode *end
,float progress
);
Creates a GskRenderNode that will do a cross-fade between start
and end
.
GskRenderNode *
gsk_cross_fade_node_get_start_child (GskRenderNode *node
);
Retrieves the child GskRenderNode at the beginning of the cross-fade.
GskRenderNode *
gsk_cross_fade_node_get_end_child (GskRenderNode *node
);
Retrieves the child GskRenderNode at the end of the cross-fade.
float
gsk_cross_fade_node_get_progress (GskRenderNode *node
);
Retrieves the progress value of the cross fade.
GskRenderNode * gsk_text_node_new (PangoFont *font
,PangoGlyphString *glyphs
,const GdkRGBA *color
,const graphene_point_t *offset
);
Creates a render node that renders the given glyphs,
Note that color
may not be used if the font contains
color glyphs.
font |
the PangoFont containing the glyphs |
|
glyphs |
the PangoGlyphString to render |
|
color |
the foreground color to render with |
|
offset |
offset of the baseline |
PangoFont *
gsk_text_node_peek_font (GskRenderNode *node
);
Returns the font used by the text node
.
const PangoGlyphInfo * gsk_text_node_peek_glyphs (GskRenderNode *node
,guint *n_glyphs
);
Retrieves the glyph information in the node
.
node |
a text GskRenderNode. |
[type GskTextNode] |
n_glyphs |
the number of glyphs returned. |
[out][optional] |
const GdkRGBA *
gsk_text_node_peek_color (GskRenderNode *node
);
Retrieves the color used by the text node
.
gboolean
gsk_text_node_has_color_glyphs (GskRenderNode *node
);
Checks whether the text node
has color glyphs.
const graphene_point_t *
gsk_text_node_get_offset (GskRenderNode *node
);
Retrieves the offset applied to the text.
GskRenderNode * gsk_blur_node_new (GskRenderNode *child
,float radius
);
Creates a render node that blurs the child.
GskRenderNode *
gsk_blur_node_get_child (GskRenderNode *node
);
Retrieves the child GskRenderNode of the blur node
.
float
gsk_blur_node_get_radius (GskRenderNode *node
);
Retrieves the blur radius of the node
.
GskRenderNode * gsk_debug_node_new (GskRenderNode *child
,char *message
);
Creates a GskRenderNode that will add debug information about
the given child
.
Adding this node has no visual effect.
GskRenderNode *
gsk_debug_node_get_child (GskRenderNode *node
);
Gets the child node that is getting drawn by the given node
.
const char *
gsk_debug_node_get_message (GskRenderNode *node
);
Gets the debug message that was set on this node
typedef struct _GskRepeatingLinearGradientNode GskRepeatingLinearGradientNode;
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 GdkTexture |
||
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 applies a color matrix to every pixel |
||
A node that repeats the child's contents |
||
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 that blends two children together |
||
A node that cross-fades between two children |
||
A node containing a glyph string |
||
A node that applies a blur |
||
Debug information that does not affect the rendering |
The filters used when scaling texture data.
The actual implementation of each filter is deferred to the rendering pipeline.
The blend modes available for render nodes.
The implementation of each blend mode is deferred to the rendering pipeline.