Snapshot

gtk.snapshot.Snapshot assists in creating gsk.render_node.RenderNodes 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 gtk.snapshot.Snapshot.pop to change the current node.

The typical way to obtain a gtk.snapshot.Snapshot object is as an argument to the vfunc@Gtk.Widget.snapshot vfunc. If you need to create your own gtk.snapshot.Snapshot, use gtk.snapshot.Snapshot.new_.

class Snapshot : Snapshot {}

Constructors

this
this()

Creates a new gtk.snapshot.Snapshot.

Members

Functions

appendBorder
void appendBorder(gsk.rounded_rect.RoundedRect outline, float[] borderWidth, gdk.rgba.RGBA[] borderColor)

Appends a stroked border rectangle inside the given outline.

appendCairo
cairo.context.Context appendCairo(graphene.rect.Rect bounds)

Creates a new gsk.cairo_node.CairoNode and appends it to the current render node of snapshot, without changing the current node.

appendColor
void appendColor(gdk.rgba.RGBA color, graphene.rect.Rect bounds)

Creates a new render node drawing the color into the given bounds and appends it to the current render node of snapshot.

appendFill
void appendFill(gsk.path.Path path, gsk.types.FillRule fillRule, gdk.rgba.RGBA color)

A convenience method to fill a path with a color.

appendInsetShadow
void appendInsetShadow(gsk.rounded_rect.RoundedRect outline, gdk.rgba.RGBA color, float dx, float dy, float spread, float blurRadius)

Appends an inset shadow into the box given by outline.

appendLayout
void appendLayout(pango.layout.Layout layout, gdk.rgba.RGBA color)
appendNode
void appendNode(gsk.render_node.RenderNode node)

Appends node to the current render node of snapshot, without changing the current node.

appendOutsetShadow
void appendOutsetShadow(gsk.rounded_rect.RoundedRect outline, gdk.rgba.RGBA color, float dx, float dy, float spread, float blurRadius)

Appends an outset shadow node around the box given by outline.

appendScaledTexture
void appendScaledTexture(gdk.texture.Texture texture, gsk.types.ScalingFilter filter, graphene.rect.Rect bounds)

Creates a new render node drawing the texture into the given bounds and appends it to the current render node of snapshot.

appendStroke
void appendStroke(gsk.path.Path path, gsk.stroke.Stroke stroke, gdk.rgba.RGBA color)

A convenience method to stroke a path with a color.

appendTexture
void appendTexture(gdk.texture.Texture texture, graphene.rect.Rect bounds)

Creates a new render node drawing the texture into the given bounds and appends it to the current render node of snapshot.

glShaderPopTexture
void glShaderPopTexture()

Removes the top element from the stack of render nodes and adds it to the nearest gsk.glshader_node.GLShaderNode below it.

perspective
void perspective(float depth)

Applies a perspective projection transform.

pop
void pop()

Removes the top element from the stack of render nodes, and appends it to the node underneath it.

pushBlend
void pushBlend(gsk.types.BlendMode blendMode)

Blends together two images with the given blend mode.

pushBlur
void pushBlur(double radius)

Blurs an image.

pushClip
void pushClip(graphene.rect.Rect bounds)

Clips an image to a rectangle.

pushColorMatrix
void pushColorMatrix(graphene.matrix.Matrix colorMatrix, graphene.vec4.Vec4 colorOffset)

Modifies the colors of an image by applying an affine transformation in RGB space.

pushCrossFade
void pushCrossFade(double progress)

Snapshots a cross-fade operation between two images with the given progress.

pushFill
void pushFill(gsk.path.Path path, gsk.types.FillRule fillRule)

Fills the area given by path and fill_rule with an image and discards everything outside of it.

pushGlShader
void pushGlShader(gsk.glshader.GLShader shader, graphene.rect.Rect bounds, glib.bytes.Bytes takeArgs)

Push a gsk.glshader_node.GLShaderNode.

pushMask
void pushMask(gsk.types.MaskMode maskMode)

Until the first call to gtk.snapshot.Snapshot.pop, the mask image for the mask operation will be recorded.

pushOpacity
void pushOpacity(double opacity)

Modifies the opacity of an image.

pushRepeat
void pushRepeat(graphene.rect.Rect bounds, graphene.rect.Rect childBounds)

Creates a node that repeats the child node.

pushRoundedClip
void pushRoundedClip(gsk.rounded_rect.RoundedRect bounds)

Clips an image to a rounded rectangle.

pushStroke
void pushStroke(gsk.path.Path path, gsk.stroke.Stroke stroke)

Strokes the given path with the attributes given by stroke and an image.

renderBackground
void renderBackground(gtk.style_context.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 snapshot, without changing the current node.

renderFocus
void renderFocus(gtk.style_context.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 snapshot, without changing the current node.

renderFrame
void renderFrame(gtk.style_context.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 snapshot, without changing the current node.

renderInsertionCursor
void renderInsertionCursor(gtk.style_context.StyleContext context, double x, double y, pango.layout.Layout layout, int index, pango.types.Direction direction)

Draws a text caret using snapshot at the specified index of layout.

renderLayout
void renderLayout(gtk.style_context.StyleContext context, double x, double y, pango.layout.Layout layout)

Creates a render node for rendering layout according to the style information in context, and appends it to the current node of snapshot, without changing the current node.

restore
void restore()

Restores snapshot to the state saved by a preceding call to gtk.snapshot.Snapshot.save and removes that state from the stack of saved states.

rotate
void rotate(float angle)

Rotates @snapshot's coordinate system by angle degrees in 2D space - or in 3D speak, rotates around the Z axis. The rotation happens around the origin point of (0, 0) in the snapshot's current coordinate system.

rotate3d
void rotate3d(float angle, graphene.vec3.Vec3 axis)

Rotates snapshot's coordinate system by angle degrees around axis.

save
void save()

Makes a copy of the current state of snapshot and saves it on an internal stack.

scale
void scale(float factorX, float factorY)

Scales snapshot's coordinate system in 2-dimensional space by the given factors.

scale3d
void scale3d(float factorX, float factorY, float factorZ)

Scales snapshot's coordinate system by the given factors.

toNode
gsk.render_node.RenderNode toNode()

Returns the render node that was constructed by snapshot.

toPaintable
gdk.paintable.Paintable toPaintable(graphene.size.Size size)

Returns a paintable encapsulating the render node that was constructed by snapshot.

transform
void transform(gsk.transform.Transform transform)

Transforms snapshot's coordinate system with the given transform.

transformMatrix
void transformMatrix(graphene.matrix.Matrix matrix)

Transforms snapshot's coordinate system with the given matrix.

translate
void translate(graphene.point.Point point)

Translates snapshot's coordinate system by point in 2-dimensional space.

translate3d
void translate3d(graphene.point3_d.Point3D point)

Translates snapshot's coordinate system by point.