`GtkSnapshot` assists in creating [class@Gsk.
RenderNode]s for widgets.
It functions in a similar way to a cairo context, and maintains a stack of render nodes and their associated transformations.
The node at the top of the stack is the one that `gtk_snapshot_append_…()` functions operate on. Use the `gtk_snapshot_push_…()`
functions and [[email protected]] to change the current node.
The typical way to obtain a `GtkSnapshot` object is as an argument to the [[email protected]] vfunc. If you need to create your
own `GtkSnapshot`, use [[email protected]].
- public void append_border (RoundedRect outline, float[] border_width, RGBA[] border_color)
Appends a stroked border rectangle inside the given outline
.
- public Context append_cairo (Rect bounds)
Creates a new [class@Gsk.
- public void append_color (RGBA color, Rect bounds)
Creates a new render node drawing the color
into the
given bounds
and appends it to the current render node of this.
- public void append_conic_gradient (Rect bounds, Point center, float rotation, ColorStop[] stops)
Appends a conic gradient node with the given stops to
this.
- public void append_inset_shadow (RoundedRect outline, RGBA color, float dx, float dy, float spread, float blur_radius)
Appends an inset shadow into the box given by outline
.
- public void append_layout (Layout layout, RGBA color)
- public void append_linear_gradient (Rect bounds, Point start_point, Point end_point, ColorStop[] stops)
Appends a linear gradient node with the given stops to
this.
- public void append_node (RenderNode node)
Appends node
to the current render node of
this, without changing the current node.
- public void append_outset_shadow (RoundedRect outline, RGBA color, float dx, float dy, float spread, float blur_radius)
Appends an outset shadow node around the box given by outline
.
- public void append_radial_gradient (Rect bounds, Point center, float hradius, float vradius, float start, float end, ColorStop[] stops)
Appends a radial gradient node with the given stops to
this.
- public void append_repeating_linear_gradient (Rect bounds, Point start_point, Point end_point, ColorStop[] stops)
Appends a repeating linear gradient node with the given stops to
this.
- public void append_repeating_radial_gradient (Rect bounds, Point center, float hradius, float vradius, float start, float end, ColorStop[] stops)
Appends a repeating radial gradient node with the given stops to
this.
- public void append_texture (Texture texture, Rect bounds)
Creates a new render node drawing the texture
into the
given bounds
and appends it to the current render node of this.
- public RenderNode? free_to_node ()
Returns the node that was constructed by
this and frees this.
- public Paintable? free_to_paintable (Size? size)
Returns a paintable for the node that was constructed by
this and frees this.
- public void gl_shader_pop_texture ()
Removes the top element from the stack of render nodes and adds it to
the nearest [class@Gsk.
- public void perspective (float depth)
Applies a perspective projection transform.
- public void pop ()
Removes the top element from the stack of render nodes, and appends it
to the node underneath it.
- public void push_blend (BlendMode blend_mode)
Blends together two images with the given blend mode.
- public void push_blur (double radius)
Blurs an image.
- public void push_clip (Rect bounds)
Clips an image to a rectangle.
- public void push_color_matrix (Matrix color_matrix, Vec4 color_offset)
Modifies the colors of an image by applying an affine transformation
in RGB space.
- public void push_cross_fade (double progress)
Snapshots a cross-fade operation between two images with the given
progress
.
- public void push_debug (string message, ...)
Inserts a debug node with a message.
- public void push_gl_shader (GLShader shader, Rect bounds, owned Bytes take_args)
Push a [class@Gsk.
- public void push_opacity (double opacity)
Modifies the opacity of an image.
- public void push_repeat (Rect bounds, Rect? child_bounds)
Creates a node that repeats the child node.
- public void push_rounded_clip (RoundedRect bounds)
Clips an image to a rounded rectangle.
- public void push_shadow (Shadow[] shadow)
Applies a shadow to an image.
- public void render_background (StyleContext context, double x, double y, double width, double height)
Creates a render node for the CSS background according to
context
, and appends it to the current node of this, without changing the current node.
- public void render_focus (StyleContext context, double x, double y, double width, double height)
Creates a render node for the focus outline according to context
, and appends it to the current node of this, without changing the current node.
- public void render_frame (StyleContext context, double x, double y, double width, double height)
Creates a render node for the CSS border according to context
, and appends it to the current node of this, without changing the current node.
- public void render_insertion_cursor (StyleContext context, double x, double y, Layout layout, int index, Direction direction)
Draws a text caret using this at the
specified index of layout
.
- public void render_layout (StyleContext context, double x, double y, Layout layout)
Creates a render node for rendering layout
according to
the style information in context
, and appends it to the current node of this, without
changing the current node.
- public void restore ()
Restores this to the state saved by
a preceding call to [method@Snapshot.
- public void rotate (float angle)
Rotates @this's coordinate system by
angle
degrees in 2D space - or in 3D speak, rotates around the Z axis.
- public void rotate_3d (float angle, Vec3 axis)
Rotates this's coordinate system by
angle
degrees around axis
.
- public void save ()
Makes a copy of the current state of this
and saves it on an internal stack.
- public void scale (float factor_x, float factor_y)
Scales this's coordinate system in
2-dimensional space by the given factors.
- public void scale_3d (float factor_x, float factor_y, float factor_z)
Scales this's coordinate system by
the given factors.
- public RenderNode? to_node ()
Returns the render node that was constructed by
this.
- public Paintable? to_paintable (Size? size)
Returns a paintable encapsulating the render node that was constructed
by this.
- public void transform (Transform? transform)
Transforms this's coordinate system
with the given transform
.
- public void transform_matrix (Matrix matrix)
Transforms this's coordinate system
with the given matrix
.
- public void translate (Point point)
Translates this's coordinate system
by point
in 2-dimensional space.
- public void translate_3d (Point3D point)
Translates this's coordinate system
by point
.