Snapshot

GtkSnapshot assists in creating GskRenderNodes 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 the one that gtk_snapshot_append_… functions operate on. Use the gtk_snapshot_push_… functions and gtk_snapshot_pop() to change the current node.

The typical way to obtain a GtkSnapshot object is as an argument to the GtkWidgetClass.snapshot() vfunc. If you need to create your own GtkSnapshot, use [ctor@Gtk.Snapshot.new].

class Snapshot : DGdkSnapshot {}

Constructors

this
this(GtkSnapshot* gtkSnapshot, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this()

Creates a new GtkSnapshot.

Members

Functions

appendBorder
void appendBorder(RoundedRect outline, float[4] borderWidth, RGBA[4] borderColor)

Appends a stroked border rectangle inside the given @outline.

appendCairo
Context appendCairo(Rect bounds)

Creates a new GskCairoNode and appends it to the current render node of @snapshot, without changing the current node.

appendColor
void appendColor(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 @snapshot.

appendConicGradient
void appendConicGradient(Rect bounds, Point center, float rotation, GskColorStop[] stops)

Appends a conic gradient node with the given stops to @snapshot.

appendInsetShadow
void appendInsetShadow(RoundedRect outline, RGBA color, float dx, float dy, float spread, float blurRadius)

Appends an inset shadow into the box given by @outline.

appendLayout
void appendLayout(PgLayout layout, RGBA color)
appendLinearGradient
void appendLinearGradient(Rect bounds, Point startPoint, Point endPoint, GskColorStop[] stops)

Appends a linear gradient node with the given stops to @snapshot.

appendNode
void appendNode(RenderNode node)

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

appendOutsetShadow
void appendOutsetShadow(RoundedRect outline, RGBA color, float dx, float dy, float spread, float blurRadius)

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

appendRadialGradient
void appendRadialGradient(Rect bounds, Point center, float hradius, float vradius, float start, float end, GskColorStop[] stops)

Appends a radial gradient node with the given stops to @snapshot.

appendRepeatingLinearGradient
void appendRepeatingLinearGradient(Rect bounds, Point startPoint, Point endPoint, GskColorStop[] stops)

Appends a repeating linear gradient node with the given stops to @snapshot.

appendRepeatingRadialGradient
void appendRepeatingRadialGradient(Rect bounds, Point center, float hradius, float vradius, float start, float end, GskColorStop[] stops)

Appends a repeating radial gradient node with the given stops to @snapshot.

appendTexture
void appendTexture(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 @snapshot.

freeToNode
RenderNode freeToNode()

Returns the node that was constructed by @snapshot and frees @snapshot.

freeToPaintable
PaintableIF freeToPaintable(Size size)

Returns a paintable for the node that was constructed by @snapshot and frees @snapshot.

getGtkSnapshotStruct
GtkSnapshot* getGtkSnapshotStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

glShaderPopTexture
void glShaderPopTexture()

Removes the top element from the stack of render nodes and adds it to the nearest GskGLShaderNode 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(GskBlendMode blendMode)

Blends together two images with the given blend mode.

pushBlur
void pushBlur(double radius)

Blurs an image.

pushClip
void pushClip(Rect bounds)

Clips an image to a rectangle.

pushColorMatrix
void pushColorMatrix(Matrix colorMatrix, 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.

pushGlShader
void pushGlShader(GLShader shader, Rect bounds, Bytes takeArgs)

Push a GskGLShaderNode.

pushOpacity
void pushOpacity(double opacity)

Modifies the opacity of an image.

pushRepeat
void pushRepeat(Rect bounds, Rect childBounds)

Creates a node that repeats the child node.

pushRoundedClip
void pushRoundedClip(RoundedRect bounds)

Clips an image to a rounded rectangle.

pushShadow
void pushShadow(GskShadow* shadow, size_t nShadows)

Applies a shadow to an image.

renderBackground
void renderBackground(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(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(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(StyleContext context, double x, double y, PgLayout layout, int index, PangoDirection direction)

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

renderLayout
void renderLayout(StyleContext context, double x, double y, PgLayout 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_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.

rotate3d
void rotate3d(float angle, 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
RenderNode toNode()

Returns the render node that was constructed by @snapshot.

toPaintable
PaintableIF toPaintable(Size size)

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

transform
void transform(Transform transform)

Transforms @snapshot's coordinate system with the given @transform.

transformMatrix
void transformMatrix(Matrix matrix)

Transforms @snapshot's coordinate system with the given @matrix.

translate
void translate(Point point)

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

translate3d
void translate3d(Point3D point)

Translates @snapshot's coordinate system by @point.

Static functions

getType
GType getType()

Variables

gtkSnapshot
GtkSnapshot* gtkSnapshot;

the main Gtk struct

Meta