It derives from <GdkSnapshot>.
Assists in creating <GskRenderNode>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 Snapshot.pop to change
the current node.
The typical way to obtain a <GtkSnapshot> object
is as an argument to the widget:do-snapshot vfunc. If you need to create your own
<GtkSnapshot>, use snapshot:new.
Note that <GtkSnapshot> applies some
optimizations, so the node it produces may not match the API calls 1:1.
For example, it will omit clip nodes if the child node is entirely
contained within the clip rectangle.
Appends a stroked border rectangle inside the given outline.
The four sides of the border can have different widths and colors.
Passed: a <GtkSnapshot>.
Passed: a <GskRoundedRect>.
the outline of the border
Passed: a f32vector, or a list or vector, each a real number.
the stroke width of the border on the top, right, bottom and left side respectively.
Passed: a list or vector, each a <GdkRGBA>.
the color used on the top, right, bottom and left side.
Creates a new <GskCairoNode> and appends it
to the current render node of self, without changing the current
node.
Passed: a <GtkSnapshot>.
Passed: a <GrapheneRect>.
the bounds for the new node
Returned: a <CairoContext>.
a <CairoContext> suitable for drawing the
contents of the newly created render node
Creates a new render node drawing the color into the given bounds and appends it to the current render node of self.
You should try to avoid calling this function if color is transparent.
Passed: a <GtkSnapshot>.
Passed: a <GdkRGBA>.
the color to draw
Passed: a <GrapheneRect>.
the bounds for the new node
Appends a conic gradient node with the given stops to self.
Passed: a <GtkSnapshot>.
Passed: a <GrapheneRect>.
the rectangle to render the gradient into
Passed: a <GraphenePoint>.
the center point of the conic gradient
Passed: a real number.
the clockwise rotation in degrees of the starting angle. 0 means the starting angle is the top.
Passed: a list or vector, each a
<GskColorStop>.
the color stops defining the gradient
Not passed: guile-gi gives the length of stops.
the number of elements in stops
A convenience method to fill a path with a color.
See snapshot:push-fill if you need to
fill a path with more complex content than a color.
Passed: a <GtkSnapshot>.
Passed: a <GskPath>.
The path describing the area to fill
Passed: a <GskFillRule>, or one of its
symbols.
The fill rule to use
Passed: a <GdkRGBA>.
the color to fill the path with
Appends an inset shadow into the box given by outline.
Passed: a <GtkSnapshot>.
Passed: a <GskRoundedRect>.
outline of the region surrounded by shadow
Passed: a <GdkRGBA>.
color of the shadow
Passed: a real number.
horizontal offset of shadow
Passed: a real number.
vertical offset of shadow
Passed: a real number.
how far the shadow spreads towards the inside
Passed: a real number.
how much blur to apply to the shadow
Creates render nodes for rendering layout in the given foregound
color and appends them to the current node of self without
changing the current node. The current theme’s foreground color for a
widget can be obtained with widget:get-color!.
Note that if the layout does not produce any visible output, then nodes may not be added to the self.
Passed: a <GtkSnapshot>.
Passed: a <PangoLayout>.
the <PangoLayout> to render
Passed: a <GdkRGBA>.
the foreground color to render the layout in
Appends a linear gradient node with the given stops to self.
Passed: a <GtkSnapshot>.
Passed: a <GrapheneRect>.
the rectangle to render the linear gradient into
Passed: a <GraphenePoint>.
the point at which the linear gradient will begin
Passed: a <GraphenePoint>.
the point at which the linear gradient will finish
Passed: a list or vector, each a
<GskColorStop>.
the color stops defining the gradient
Not passed: guile-gi gives the length of stops.
the number of elements in stops
Appends node to the current render node of self, without changing the current node.
If self does not have a current node yet, node will become the initial node.
Passed: a <GtkSnapshot>.
Passed: a <GskRenderNode>.
Appends an outset shadow node around the box given by outline.
Passed: a <GtkSnapshot>.
Passed: a <GskRoundedRect>.
outline of the region surrounded by shadow
Passed: a <GdkRGBA>.
color of the shadow
Passed: a real number.
horizontal offset of shadow
Passed: a real number.
vertical offset of shadow
Passed: a real number.
how far the shadow spreads towards the outside
Passed: a real number.
how much blur to apply to the shadow
Creates a new render node that pastes the contents copied by a previous
call to snapshot:push-copy
Passed: a <GtkSnapshot>.
Passed: a <GrapheneRect>.
the bounds for the new node
Passed: an unsigned 64-bit integer.
the index of the copy, with 0 being the latest copy, 1 being the copy before that, and so on.
Appends a radial gradient node with the given stops to self.
Passed: a <GtkSnapshot>.
Passed: a <GrapheneRect>.
the rectangle to render the readial gradient into
Passed: a <GraphenePoint>.
the center point for the radial gradient
Passed: a real number.
the horizontal radius
Passed: a real number.
the vertical radius
Passed: a real number.
the start position (on the horizontal axis)
Passed: a real number.
the end position (on the horizontal axis)
Passed: a list or vector, each a
<GskColorStop>.
the color stops defining the gradient
Not passed: guile-gi gives the length of stops.
the number of elements in stops
Appends a repeating linear gradient node with the given stops to self.
Passed: a <GtkSnapshot>.
Passed: a <GrapheneRect>.
the rectangle to render the linear gradient into
Passed: a <GraphenePoint>.
the point at which the linear gradient will begin
Passed: a <GraphenePoint>.
the point at which the linear gradient will finish
Passed: a list or vector, each a
<GskColorStop>.
the color stops defining the gradient
Not passed: guile-gi gives the length of stops.
the number of elements in stops
Appends a repeating radial gradient node with the given stops to self.
Passed: a <GtkSnapshot>.
Passed: a <GrapheneRect>.
the rectangle to render the readial gradient into
Passed: a <GraphenePoint>.
the center point for the radial gradient
Passed: a real number.
the horizontal radius
Passed: a real number.
the vertical radius
Passed: a real number.
the start position (on the horizontal axis)
Passed: a real number.
the end position (on the horizontal axis)
Passed: a list or vector, each a
<GskColorStop>.
the color stops defining the gradient
Not passed: guile-gi gives the length of stops.
the number of elements in stops
Creates a new render node drawing the texture into the given bounds and appends it to the current render node of self.
In contrast to snapshot:append-texture, this function provides
control about how the filter that is used when scaling.
Passed: a <GtkSnapshot>.
Passed: a <GdkTexture>.
the texture to render
Passed: a <GskScalingFilter>, or one of
its symbols.
the filter to use
Passed: a <GrapheneRect>.
the bounds for the new node
A convenience method to stroke a path with a color.
See snapshot:push-stroke if you need
to stroke a path with more complex content than a color.
Passed: a <GtkSnapshot>.
Passed: a <GskPath>.
The path describing the area to fill
Passed: a <GskStroke>.
The stroke attributes
Passed: a <GdkRGBA>.
the color to fill the path with
Creates a new render node drawing the texture into the given bounds and appends it to the current render node of self.
If the texture needs to be scaled to fill bounds, linear filtering
is used. See snapshot:append-scaled-texture if you need
other filtering, such as nearest-neighbour.
Passed: a <GtkSnapshot>.
Passed: a <GdkTexture>.
the texture to render
Passed: a <GrapheneRect>.
the bounds for the new node
Removes the top element from the stack of render nodes and adds it to
the nearest <GskGLShaderNode> below it.
This must be called the same number of times as the number of textures
is needed for the shader in snapshot:push-gl-shader.
Passed: a <GtkSnapshot>.
Creates a new <GtkSnapshot>.
Returned: a <GtkSnapshot>.
a newly-allocated <GtkSnapshot>
Applies a perspective projection transform.
See transform:perspective for a
discussion on the details.
Passed: a <GtkSnapshot>.
Passed: a real number.
distance of the z=0 plane
Removes the top element from the stack of render nodes, and appends it to the node underneath it.
Passed: a <GtkSnapshot>.
Blends together two images with the given blend mode.
Until the first call to snapshot:pop, the
bottom image for the blend operation will be recorded. After that call,
the top image to be blended will be recorded until the second call to
snapshot:pop.
Calling this function requires two subsequent calls to
snapshot:pop.
Passed: a <GtkSnapshot>.
Passed: a <GskBlendMode>, or one of its
symbols.
blend mode to use
Blurs an image.
The image is recorded until the next call to snapshot:pop.
Passed: a <GtkSnapshot>.
Passed: a real number.
the blur radius to use. Must be positive
Clips an image to a rectangle.
The image is recorded until the next call to snapshot:pop.
Passed: a <GtkSnapshot>.
Passed: a <GrapheneRect>.
the rectangle to clip to
Modifies the colors of an image by applying an affine transformation in RGB space.
In particular, the colors will be transformed by applying
pixel = transpose(color_matrix) * pixel + color_offset
for every pixel. The transformation operates on unpremultiplied colors, with color components ordered R, G, B, A.
The image is recorded until the next call to snapshot:pop.
Passed: a <GtkSnapshot>.
Passed: a <GrapheneMatrix>.
the color matrix to use
Passed: a <GrapheneVec4>.
the color offset to use
Modifies the colors of an image by applying a transfer function for each component.
The transfer functions operate on unpremultiplied colors.
The image is recorded until the next call to snapshot:pop.
Passed: a <GtkSnapshot>.
Passed: a <GskComponentTransfer>.
the transfer for the red component
Passed: a <GskComponentTransfer>.
the transfer for the green component
Passed: a <GskComponentTransfer>.
the transfer for the blue component
Passed: a <GskComponentTransfer>.
the transfer for the alpha component
Until the first call to snapshot:pop, the
mask image for the mask operation will be recorded.
After that call, the child image will be recorded until the second call
to snapshot:pop.
Calling this function requires 2 subsequent calls to snapshot:pop.
Passed: a <GtkSnapshot>.
Passed: a <GskPorterDuff>, or one of its
symbols.
The Porter/Duff compositing operator to use
Stores the current rendering state for later pasting via
snapshot:append-paste.
Pasting is possible until the matching call to snapshot:pop.
Passed: a <GtkSnapshot>.
Snapshots a cross-fade operation between two images with the given progress.
Until the first call to snapshot:pop, the
start image will be snapshot. After that call, the end image will be
recorded until the second call to snapshot:pop.
Calling this function requires two subsequent calls to
snapshot:pop.
Passed: a <GtkSnapshot>.
Passed: a real number.
progress between 0.0 and 1.0
Fills the area given by path and fill-rule with an image and discards everything outside of it.
The image is recorded until the next call to snapshot:pop.
If you want to fill the path with a color, snapshot:append-fill than rendering new ones, use
snapshot:append-fill may be more
convenient.
Passed: a <GtkSnapshot>.
Passed: a <GskPath>.
The path describing the area to fill
Passed: a <GskFillRule>, or one of its
symbols.
The fill rule to use
Push a <GskGLShaderNode>.
The node uses the given <GskGLShader> and uniform values
Additionally this takes a list of n-children other nodes which
will be passed to the <GskGLShaderNode>.
The take-args argument is a block of data to use for uniform
arguments, as per types and offsets defined by the shader.
Normally this is generated by Gsk.GLShader.format_args or
<GskShaderArgsBuilder>.
The snapshotter takes ownership of take-args, so the caller should not free it after this.
If the renderer doesn’t support GL shaders, or if there is any problem
when compiling the shader, then the node will draw pink. You should use
Gsk.GLShader.compile to ensure the shader will work for the
renderer before using it.
If the shader requires textures (see
Gsk.GLShader.get_n_textures), then it is expected that you call
snapshot:gl-shader-pop-texture the number of
times that are required. Each of these calls will generate a node that
is added as a child to the
<GskGLShaderNode>, which in turn will
render these offscreen and pass as a texture to the shader.
Once all textures (if any) are pop:ed, you must call the regular
snapshot:pop.
If you want to use pre-existing textures as input to the shader rather
than rendering new ones, use snapshot:append-texture to push a texture node. These
will be used directly rather than being re-rendered.
For details on how to write shaders, see <GskGLShader>.
Passed: a <GtkSnapshot>.
Passed: a <GskGLShader>.
The code to run
Passed: a <GrapheneRect>.
the rectangle to render into
Passed: a <GBytes>.
Data block with arguments for the shader.
Isolates the following drawing operations from previous ones.
You can express "everything but these flags" in a forward compatible way
by using bit math: GSK_ISOLATION_ALL & ~(GSK_ISOLATION_BACKGROUND
| GSK_ISOLATION_COPY_PASTE) will isolate everything but background and
copy/paste.
For what isolation features exist, see
<GskIsolation>.
Content is isolated until the next call to snapshot:pop.
Passed: a <GtkSnapshot>.
Passed: a <GskIsolation>, or a list of its
symbols, or one of them.
features that are isolated
Until the first call to snapshot:pop, the
mask image for the mask operation will be recorded.
After that call, the source image will be recorded until the second call
to snapshot:pop.
Calling this function requires 2 subsequent calls to snapshot:pop.
Passed: a <GtkSnapshot>.
Passed: a <GskMaskMode>, or one of its
symbols.
mask mode to use
Modifies the opacity of an image.
The image is recorded until the next call to snapshot:pop.
Passed: a <GtkSnapshot>.
Passed: a real number.
the opacity to use
Creates a node that repeats the child node.
The child is recorded until the next call to snapshot:pop.
Passed: a <GtkSnapshot>.
Passed: a <GrapheneRect>.
the bounds within which to repeat
Passed, or left out: a <GrapheneRect>, or
#f.
the bounds of the child or #f to use the full size of the
collected child node
Clips an image to a rounded rectangle.
The image is recorded until the next call to snapshot:pop.
Passed: a <GtkSnapshot>.
Passed: a <GskRoundedRect>.
the rounded rectangle to clip to
Applies a shadow to an image.
The image is recorded until the next call to snapshot:pop.
Passed: a <GtkSnapshot>.
Passed: a list or vector, each a <GskShadow>.
the first shadow specification
Not passed: guile-gi gives the length of shadow.
number of shadow specifications
Strokes the given path with the attributes given by stroke and an image.
The image is recorded until the next call to snapshot:pop.
Note that the strokes are subject to the same transformation as everything else, so uneven scaling will cause horizontal and vertical strokes to have different widths.
If you want to stroke the path with a color, snapshot:append-stroke may be more convenient.
Passed: a <GtkSnapshot>.
Passed: a <GskPath>.
The path to stroke
Passed: a <GskStroke>.
The stroke attributes
Creates a render node for the CSS background according to context, and appends it to the current node of self, without changing the current node.
Passed: a <GtkSnapshot>.
Passed: a <GtkStyleContext>.
the style context that defines the background
Passed: a real number.
X origin of the rectangle
Passed: a real number.
Y origin of the rectangle
Passed: a real number.
rectangle width
Passed: a real number.
rectangle height
Creates a render node for the focus outline according to context, and appends it to the current node of self, without changing the current node.
Passed: a <GtkSnapshot>.
Passed: a <GtkStyleContext>.
the style context that defines the focus ring
Passed: a real number.
X origin of the rectangle
Passed: a real number.
Y origin of the rectangle
Passed: a real number.
rectangle width
Passed: a real number.
rectangle height
Creates a render node for the CSS border according to context, and appends it to the current node of self, without changing the current node.
Passed: a <GtkSnapshot>.
Passed: a <GtkStyleContext>.
the style context that defines the frame
Passed: a real number.
X origin of the rectangle
Passed: a real number.
Y origin of the rectangle
Passed: a real number.
rectangle width
Passed: a real number.
rectangle height
Draws a text caret using self at the specified index of layout.
Passed: a <GtkSnapshot>.
snapshot to render to
Passed: a <GtkStyleContext>.
a GtkStyleContext
Passed: a real number.
X origin
Passed: a real number.
Y origin
Passed: a <PangoLayout>.
the <PangoLayout> of the text
Passed: a 32-bit integer.
the index in the <PangoLayout>
Passed: a <PangoDirection>, or one of its
symbols.
the <PangoDirection> of the text
Creates a render node for rendering layout according to the style information in context, and appends it to the current node of self, without changing the current node.
Passed: a <GtkSnapshot>.
Passed: a <GtkStyleContext>.
the style context that defines the text
Passed: a real number.
X origin of the rectangle
Passed: a real number.
Y origin of the rectangle
Passed: a <PangoLayout>.
the <PangoLayout> to render
Restores self to the state saved by a preceding call to
Snapshot.save and removes that state from the stack of saved
states.
Passed: a <GtkSnapshot>.
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 self’s current coordinate system.
To rotate around axes other than the Z axis, use transform:rotate-3d.
Passed: a <GtkSnapshot>.
Passed: a real number.
the rotation angle, in degrees (clockwise)
Rotates self’s coordinate system by angle degrees around axis.
For a rotation in 2D space, use transform:rotate.
Passed: a <GtkSnapshot>.
Passed: a real number.
the rotation angle, in degrees (clockwise)
Passed: a <GrapheneVec3>.
The rotation axis
Makes a copy of the current state of self and saves it on an internal stack.
When snapshot:restore is called,
self will be restored to the saved state.
Multiple calls to snapshot:save and
snapshot:restore can be nested; each call
to snapshot:restore restores the state
from the matching paired snapshot:save.
It is necessary to clear all saved states with corresponding calls to
snapshot:restore.
Passed: a <GtkSnapshot>.
Scales self’s coordinate system in 2-dimensional space by the given factors.
Use snapshot:scale-3d to scale in all 3
dimensions.
Passed: a <GtkSnapshot>.
Passed: a real number.
scaling factor on the X axis
Passed: a real number.
scaling factor on the Y axis
Scales self’s coordinate system by the given factors.
Passed: a <GtkSnapshot>.
Passed: a real number.
scaling factor on the X axis
Passed: a real number.
scaling factor on the Y axis
Passed: a real number.
scaling factor on the Z axis
Returns the render node that was constructed by self.
Note that this function may return #f if nothing has been added
to the snapshot or if its content does not produce pixels to be
rendered.
After calling this function, it is no longer possible to add more nodes
to self. The only function that should be called after this is
object:unref.
Passed: a <GtkSnapshot>.
Returned: a <GskRenderNode>, or #f.
the constructed <GskRenderNode> or
#f if there are no nodes to render.
Returns a paintable encapsulating the render node that was constructed by self.
After calling this function, it is no longer possible to add more nodes
to self. The only function that should be called after this is
object:unref.
Passed: a <GtkSnapshot>.
Passed, or left out: a <GrapheneSize>, or
#f.
The size of the resulting paintable or #f to use the bounds of
the snapshot
Returned: a <GdkPaintable>, or #f.
a new <GdkPaintable>
Transforms self’s coordinate system with the given transform.
Passed: a <GtkSnapshot>.
Passed, or left out: a <GskTransform>, or
#f.
the transform to apply
Transforms self’s coordinate system with the given matrix.
Passed: a <GtkSnapshot>.
Passed: a <GrapheneMatrix>.
the matrix to multiply the transform with
Translates self’s coordinate system by point in 2-dimensional space.
Passed: a <GtkSnapshot>.
Passed: a <GraphenePoint>.
the point to translate the snapshot by
Translates self’s coordinate system by point.
Passed: a <GtkSnapshot>.
Passed: a <GraphenePoint3D>.
the point to translate the snapshot by