gi-gtk4-4.0.12: Gtk 4.x bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gtk.Objects.Snapshot

Contents

- Exported types
- Methods
  - appendBorder
  - appendCairo
  - appendColor
  - appendConicGradient
  - appendFill
  - appendInsetShadow
  - appendLayout
  - appendLinearGradient
  - appendNode
  - appendOutsetShadow
  - appendPaste
  - appendRadialGradient
  - appendRepeatingLinearGradient
  - appendRepeatingRadialGradient
  - appendScaledTexture
  - appendStroke
  - appendTexture
  - glShaderPopTexture
  - new
  - perspective
  - pop
  - pushBlend
  - pushBlur
  - pushClip
  - pushColorMatrix
  - pushComponentTransfer
  - pushComposite
  - pushCopy
  - pushCrossFade
  - pushFill
  - pushGlShader
  - pushIsolation
  - pushMask
  - pushOpacity
  - pushRepeat
  - pushRoundedClip
  - pushShadow
  - pushStroke
  - renderBackground
  - renderFocus
  - renderFrame
  - renderInsertionCursor
  - renderLayout
  - restore
  - rotate
  - rotate3d
  - save
  - scale
  - scale3d
  - toNode
  - toPaintable
  - transform
  - transformMatrix
  - translate
  - translate3d

Description

Assists in creating `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 [method`snapshot`.pop] to change the current node.

The typical way to obtain a `GtkSnapshot` object is as an argument to the `Widget`.`snapshot`() vfunc. If you need to create your own `GtkSnapshot`, use `snapshotNew`.

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.

Synopsis

- newtype Snapshot = Snapshot (ManagedPtr Snapshot)
- class (GObject o, IsDescendantOf Snapshot o) => IsSnapshot o
- toSnapshot :: (MonadIO m, IsSnapshot o) => o -> m Snapshot
- snapshotAppendBorder :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> RoundedRect -> [Float] -> [RGBA] -> m ()
- snapshotAppendCairo :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Rect -> m Context
- snapshotAppendColor :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> RGBA -> Rect -> m ()
- snapshotAppendConicGradient :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Rect -> Point -> Float -> [ColorStop] -> m ()
- snapshotAppendFill :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Path -> FillRule -> RGBA -> m ()
- snapshotAppendInsetShadow :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> RoundedRect -> RGBA -> Float -> Float -> Float -> Float -> m ()
- snapshotAppendLayout :: (HasCallStack, MonadIO m, IsSnapshot a, IsLayout b) => a -> b -> RGBA -> m ()
- snapshotAppendLinearGradient :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Rect -> Point -> Point -> [ColorStop] -> m ()
- snapshotAppendNode :: (HasCallStack, MonadIO m, IsSnapshot a, IsRenderNode b) => a -> b -> m ()
- snapshotAppendOutsetShadow :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> RoundedRect -> RGBA -> Float -> Float -> Float -> Float -> m ()
- snapshotAppendPaste :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Rect -> CSize -> m ()
- snapshotAppendRadialGradient :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Rect -> Point -> Float -> Float -> Float -> Float -> [ColorStop] -> m ()
- snapshotAppendRepeatingLinearGradient :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Rect -> Point -> Point -> [ColorStop] -> m ()
- snapshotAppendRepeatingRadialGradient :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Rect -> Point -> Float -> Float -> Float -> Float -> [ColorStop] -> m ()
- snapshotAppendScaledTexture :: (HasCallStack, MonadIO m, IsSnapshot a, IsTexture b) => a -> b -> ScalingFilter -> Rect -> m ()
- snapshotAppendStroke :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Path -> Stroke -> RGBA -> m ()
- snapshotAppendTexture :: (HasCallStack, MonadIO m, IsSnapshot a, IsTexture b) => a -> b -> Rect -> m ()
- snapshotGlShaderPopTexture :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> m ()
- snapshotNew :: (HasCallStack, MonadIO m) => m Snapshot
- snapshotPerspective :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Float -> m ()
- snapshotPop :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> m ()
- snapshotPushBlend :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> BlendMode -> m ()
- snapshotPushBlur :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Double -> m ()
- snapshotPushClip :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Rect -> m ()
- snapshotPushColorMatrix :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Matrix -> Vec4 -> m ()
- snapshotPushComponentTransfer :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> ComponentTransfer -> ComponentTransfer -> ComponentTransfer -> ComponentTransfer -> m ()
- snapshotPushComposite :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> PorterDuff -> m ()
- snapshotPushCopy :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> m ()
- snapshotPushCrossFade :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Double -> m ()
- snapshotPushFill :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Path -> FillRule -> m ()
- snapshotPushGlShader :: (HasCallStack, MonadIO m, IsSnapshot a, IsGLShader b) => a -> b -> Rect -> Bytes -> m ()
- snapshotPushIsolation :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> [Isolation] -> m ()
- snapshotPushMask :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> MaskMode -> m ()
- snapshotPushOpacity :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Double -> m ()
- snapshotPushRepeat :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Rect -> Maybe Rect -> m ()
- snapshotPushRoundedClip :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> RoundedRect -> m ()
- snapshotPushShadow :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> [Shadow] -> m ()
- snapshotPushStroke :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Path -> Stroke -> m ()
- snapshotRenderBackground :: (HasCallStack, MonadIO m, IsSnapshot a, IsStyleContext b) => a -> b -> Double -> Double -> Double -> Double -> m ()
- snapshotRenderFocus :: (HasCallStack, MonadIO m, IsSnapshot a, IsStyleContext b) => a -> b -> Double -> Double -> Double -> Double -> m ()
- snapshotRenderFrame :: (HasCallStack, MonadIO m, IsSnapshot a, IsStyleContext b) => a -> b -> Double -> Double -> Double -> Double -> m ()
- snapshotRenderInsertionCursor :: (HasCallStack, MonadIO m, IsSnapshot a, IsStyleContext b, IsLayout c) => a -> b -> Double -> Double -> c -> Int32 -> Direction -> m ()
- snapshotRenderLayout :: (HasCallStack, MonadIO m, IsSnapshot a, IsStyleContext b, IsLayout c) => a -> b -> Double -> Double -> c -> m ()
- snapshotRestore :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> m ()
- snapshotRotate :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Float -> m ()
- snapshotRotate3d :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Float -> Vec3 -> m ()
- snapshotSave :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> m ()
- snapshotScale :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Float -> Float -> m ()
- snapshotScale3d :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Float -> Float -> Float -> m ()
- snapshotToNode :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> m (Maybe RenderNode)
- snapshotToPaintable :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Maybe Size -> m (Maybe Paintable)
- snapshotTransform :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Maybe Transform -> m ()
- snapshotTransformMatrix :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Matrix -> m ()
- snapshotTranslate :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Point -> m ()
- snapshotTranslate3d :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Point3D -> m ()

# Exported types

newtype Snapshot Source #

Memory-managed wrapper type.

Constructors

Snapshot (ManagedPtr Snapshot) |

#### Instances

Instances details

Eq Snapshot Source # |
Instance details Defined in GI.Gtk.Objects.Snapshot Methods (==) :: Snapshot -> Snapshot -> Bool Source # (/=) :: Snapshot -> Snapshot -> Bool Source #
GObject Snapshot Source # |
Instance details Defined in GI.Gtk.Objects.Snapshot
ManagedPtrNewtype Snapshot Source # |
Instance details Defined in GI.Gtk.Objects.Snapshot Methods toManagedPtr :: Snapshot -> ManagedPtr Snapshot Source #
TypedObject Snapshot Source # |
Instance details Defined in GI.Gtk.Objects.Snapshot Methods glibType :: IO GType Source #
HasParentTypes Snapshot Source # |
Instance details Defined in GI.Gtk.Objects.Snapshot
IsGValue (Maybe Snapshot) Source # | Convert `Snapshot` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gtk.Objects.Snapshot Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe Snapshot -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe Snapshot) Source #
type ParentTypes Snapshot Source # |
Instance details Defined in GI.Gtk.Objects.Snapshot type ParentTypes Snapshot = '[Snapshot, Object]

class (GObject o, IsDescendantOf Snapshot o) => IsSnapshot o Source #

Type class for types which can be safely cast to `Snapshot`, for instance with `toSnapshot`.

#### Instances

Instances details

(GObject o, IsDescendantOf Snapshot o) => IsSnapshot o Source # |
Instance details Defined in GI.Gtk.Objects.Snapshot

toSnapshot :: (MonadIO m, IsSnapshot o) => o -> m Snapshot Source #

Cast to `Snapshot`, for types for which this is known to be safe. For general casts, use `castTo`.

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

appendBorder, appendCairo, appendColor, appendConicGradient, appendFill, appendInsetShadow, appendLayout, appendLinearGradient, appendNode, appendOutsetShadow, appendPaste, appendRadialGradient, appendRepeatingLinearGradient, appendRepeatingRadialGradient, appendScaledTexture, appendStroke, appendTexture, bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, glShaderPopTexture, isFloating, notify, notifyByPspec, perspective, pop, pushBlend, pushBlur, pushClip, pushColorMatrix, pushComponentTransfer, pushComposite, pushCopy, pushCrossFade, pushFill, pushGlShader, pushIsolation, pushMask, pushOpacity, pushRepeat, pushRoundedClip, pushShadow, pushStroke, ref, refSink, renderBackground, renderFocus, renderFrame, renderInsertionCursor, renderLayout, restore, rotate, rotate3d, runDispose, save, scale, scale3d, stealData, stealQdata, thawNotify, toNode, toPaintable, transform, transformMatrix, translate, translate3d, unref, watchClosure.

#### Getters

getData, getProperty, getQdata.

#### Setters

setData, setDataFull, setProperty.

## appendBorder

snapshotAppendBorder Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> RoundedRect | `outline`: the outline of the border
-> [Float] | `borderWidth`: the stroke width of the border on the top, right, bottom and left side respectively.
-> [RGBA] | `borderColor`: the color used on the top, right, bottom and left side.
-> m () |

Appends a stroked border rectangle inside the given `outline`.

The four sides of the border can have different widths and colors.

## appendCairo

snapshotAppendCairo Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Rect | `bounds`: the bounds for the new node
-> m Context | Returns: a `cairo_t` suitable for drawing the contents of the newly created render node

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

## appendColor

snapshotAppendColor Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> RGBA | `color`: the color to draw
-> Rect | `bounds`: the bounds for the new node
-> m () |

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

You should try to avoid calling this function if `color` is transparent.

## appendConicGradient

snapshotAppendConicGradient Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Rect | `bounds`: the rectangle to render the gradient into
-> Point | `center`: the center point of the conic gradient
-> Float | `rotation`: the clockwise rotation in degrees of the starting angle. 0 means the starting angle is the top.
-> [ColorStop] | `stops`: the color stops defining the gradient
-> m () |

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

## appendFill

snapshotAppendFill Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Path | `path`: The path describing the area to fill
-> FillRule | `fillRule`: The fill rule to use
-> RGBA | `color`: the color to fill the path with
-> m () |

A convenience method to fill a path with a color.

See `snapshotPushFill` if you need to fill a path with more complex content than a color.

Since: 4.14

## appendInsetShadow

snapshotAppendInsetShadow Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> RoundedRect | `outline`: outline of the region surrounded by shadow
-> RGBA | `color`: color of the shadow
-> Float | `dx`: horizontal offset of shadow
-> Float | `dy`: vertical offset of shadow
-> Float | `spread`: how far the shadow spreads towards the inside
-> Float | `blurRadius`: how much blur to apply to the shadow
-> m () |

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

## appendLayout

snapshotAppendLayout Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a, IsLayout b) |
=> a | `snapshot`: a `GtkSnapshot`
-> b | `layout`: the `PangoLayout` to render
-> RGBA | `color`: the foreground color to render the layout in
-> m () |

Creates render nodes for rendering `layout` in the given foregound `color` and appends them to the current node of `snapshot` without changing the current node. The current theme's foreground color for a widget can be obtained with `widgetGetColor`.

Note that if the layout does not produce any visible output, then nodes may not be added to the `snapshot`.

## appendLinearGradient

snapshotAppendLinearGradient Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Rect | `bounds`: the rectangle to render the linear gradient into
-> Point | `startPoint`: the point at which the linear gradient will begin
-> Point | `endPoint`: the point at which the linear gradient will finish
-> [ColorStop] | `stops`: the color stops defining the gradient
-> m () |

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

## appendNode

snapshotAppendNode Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a, IsRenderNode b) |
=> a | `snapshot`: a `GtkSnapshot`
-> b | `node`: a `GskRenderNode`
-> m () |

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

If `snapshot` does not have a current node yet, `node` will become the initial node.

## appendOutsetShadow

snapshotAppendOutsetShadow Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> RoundedRect | `outline`: outline of the region surrounded by shadow
-> RGBA | `color`: color of the shadow
-> Float | `dx`: horizontal offset of shadow
-> Float | `dy`: vertical offset of shadow
-> Float | `spread`: how far the shadow spreads towards the outside
-> Float | `blurRadius`: how much blur to apply to the shadow
-> m () |

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

## appendPaste

snapshotAppendPaste Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Rect | `bounds`: the bounds for the new node
-> CSize | `nth`: the index of the copy, with 0 being the latest copy, 1 being the copy before that, and so on.
-> m () |

Creates a new render node that pastes the contents copied by a previous call to `snapshotPushCopy`

Since: 4.22

## appendRadialGradient

snapshotAppendRadialGradient Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Rect | `bounds`: the rectangle to render the readial gradient into
-> Point | `center`: the center point for the radial gradient
-> Float | `hradius`: the horizontal radius
-> Float | `vradius`: the vertical radius
-> Float | `start`: the start position (on the horizontal axis)
-> Float | `end`: the end position (on the horizontal axis)
-> [ColorStop] | `stops`: the color stops defining the gradient
-> m () |

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

## appendRepeatingLinearGradient

snapshotAppendRepeatingLinearGradient Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Rect | `bounds`: the rectangle to render the linear gradient into
-> Point | `startPoint`: the point at which the linear gradient will begin
-> Point | `endPoint`: the point at which the linear gradient will finish
-> [ColorStop] | `stops`: the color stops defining the gradient
-> m () |

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

## appendRepeatingRadialGradient

snapshotAppendRepeatingRadialGradient Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Rect | `bounds`: the rectangle to render the readial gradient into
-> Point | `center`: the center point for the radial gradient
-> Float | `hradius`: the horizontal radius
-> Float | `vradius`: the vertical radius
-> Float | `start`: the start position (on the horizontal axis)
-> Float | `end`: the end position (on the horizontal axis)
-> [ColorStop] | `stops`: the color stops defining the gradient
-> m () |

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

## appendScaledTexture

snapshotAppendScaledTexture Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a, IsTexture b) |
=> a | `snapshot`: a `GtkSnapshot`
-> b | `texture`: the texture to render
-> ScalingFilter | `filter`: the filter to use
-> Rect | `bounds`: the bounds for the new node
-> m () |

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

In contrast to `snapshotAppendTexture`, this function provides control about how the filter that is used when scaling.

Since: 4.10

## appendStroke

snapshotAppendStroke Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Path | `path`: The path describing the area to fill
-> Stroke | `stroke`: The stroke attributes
-> RGBA | `color`: the color to fill the path with
-> m () |

A convenience method to stroke a path with a color.

See `snapshotPushStroke` if you need to stroke a path with more complex content than a color.

Since: 4.14

## appendTexture

snapshotAppendTexture Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a, IsTexture b) |
=> a | `snapshot`: a `GtkSnapshot`
-> b | `texture`: the texture to render
-> Rect | `bounds`: the bounds for the new node
-> m () |

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

If the texture needs to be scaled to fill `bounds`, linear filtering is used. See `snapshotAppendScaledTexture` if you need other filtering, such as nearest-neighbour.

## glShaderPopTexture

snapshotGlShaderPopTexture Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> m () |

Deprecated: (Since version 4.16)GTK's new Vulkan-focused renderingdoes not support this feature. Use `GLArea` forOpenGL rendering.

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

This must be called the same number of times as the number of textures is needed for the shader in `snapshotPushGlShader`.

## new

snapshotNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Snapshot | Returns: a newly-allocated `GtkSnapshot`

Creates a new `GtkSnapshot`.

## perspective

snapshotPerspective Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Float | `depth`: distance of the z=0 plane
-> m () |

Applies a perspective projection transform.

See `transformPerspective` for a discussion on the details.

## pop

snapshotPop Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> m () |

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

## pushBlend

snapshotPushBlend Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> BlendMode | `blendMode`: blend mode to use
-> m () |

Blends together two images with the given blend mode.

Until the first call to `snapshotPop`, 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 `snapshotPop`.

Calling this function requires two subsequent calls to `snapshotPop`.

## pushBlur

snapshotPushBlur Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Double | `radius`: the blur radius to use. Must be positive
-> m () |

Blurs an image.

The image is recorded until the next call to `snapshotPop`.

## pushClip

snapshotPushClip Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Rect | `bounds`: the rectangle to clip to
-> m () |

Clips an image to a rectangle.

The image is recorded until the next call to `snapshotPop`.

## pushColorMatrix

snapshotPushColorMatrix Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Matrix | `colorMatrix`: the color matrix to use
-> Vec4 | `colorOffset`: the color offset to use
-> m () |

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 `snapshotPop`.

## pushComponentTransfer

snapshotPushComponentTransfer Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> ComponentTransfer | `red`: the transfer for the red component
-> ComponentTransfer | `green`: the transfer for the green component
-> ComponentTransfer | `blue`: the transfer for the blue component
-> ComponentTransfer | `alpha`: the transfer for the alpha component
-> m () |

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 `snapshotPop`.

Since: 4.20

## pushComposite

snapshotPushComposite Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> PorterDuff | `op`: The Porter/Duff compositing operator to use
-> m () |

Until the first call to `snapshotPop`, the mask image for the mask operation will be recorded.

After that call, the child image will be recorded until the second call to `snapshotPop`.

Calling this function requires 2 subsequent calls to `snapshotPop`.

Since: 4.22

## pushCopy

snapshotPushCopy Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> m () |

Stores the current rendering state for later pasting via `snapshotAppendPaste`.

Pasting is possible until the matching call to `snapshotPop`.

Since: 4.22

## pushCrossFade

snapshotPushCrossFade Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Double | `progress`: progress between 0.0 and 1.0
-> m () |

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

Until the first call to `snapshotPop`, the start image will be snapshot. After that call, the end image will be recorded until the second call to `snapshotPop`.

Calling this function requires two subsequent calls to `snapshotPop`.

## pushFill

snapshotPushFill Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Path | `path`: The path describing the area to fill
-> FillRule | `fillRule`: The fill rule to use
-> m () |

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

The image is recorded until the next call to `snapshotPop`.

If you want to fill the path with a color, `snapshotAppendFill` than rendering new ones, use `snapshotAppendFill` may be more convenient.

Since: 4.14

## pushGlShader

snapshotPushGlShader Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a, IsGLShader b) |
=> a | `snapshot`: a `GtkSnapshot`
-> b | `shader`: The code to run
-> Rect | `bounds`: the rectangle to render into
-> Bytes | `takeArgs`: Data block with arguments for the shader.
-> m () |

Deprecated: (Since version 4.16)GTK's new Vulkan-focused renderingdoes not support this feature. Use `GLArea` forOpenGL rendering.

Push a `GLShaderNode`.

The node uses the given `GLShader` and uniform values Additionally this takes a list of `nChildren` other nodes which will be passed to the `GLShaderNode`.

The `takeArgs` 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 `GLShader`.`format_args`() or `ShaderArgsBuilder`.

The snapshotter takes ownership of `takeArgs`, 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 `gLShaderCompile` to ensure the `shader` will work for the renderer before using it.

If the shader requires textures (see `gLShaderGetNTextures`), then it is expected that you call `snapshotGlShaderPopTexture` 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 `snapshotPop`.

If you want to use pre-existing textures as input to the shader rather than rendering new ones, use `snapshotAppendTexture` to push a texture node. These will be used directly rather than being re-rendered.

For details on how to write shaders, see `GLShader`.

## pushIsolation

snapshotPushIsolation Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> [Isolation] | `features`: features that are isolated
-> m () |

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 [flags`gsk`.Isolation].

Content is isolated until the next call to `snapshotPop`.

Since: 4.22

## pushMask

snapshotPushMask Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> MaskMode | `maskMode`: mask mode to use
-> m () |

Until the first call to `snapshotPop`, the mask image for the mask operation will be recorded.

After that call, the source image will be recorded until the second call to `snapshotPop`.

Calling this function requires 2 subsequent calls to `snapshotPop`.

Since: 4.10

## pushOpacity

snapshotPushOpacity Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Double | `opacity`: the opacity to use
-> m () |

Modifies the opacity of an image.

The image is recorded until the next call to `snapshotPop`.

## pushRepeat

snapshotPushRepeat Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Rect | `bounds`: the bounds within which to repeat
-> Maybe Rect | `childBounds`: the bounds of the child or `Nothing` to use the full size of the collected child node
-> m () |

Creates a node that repeats the child node.

The child is recorded until the next call to `snapshotPop`.

## pushRoundedClip

snapshotPushRoundedClip Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> RoundedRect | `bounds`: the rounded rectangle to clip to
-> m () |

Clips an image to a rounded rectangle.

The image is recorded until the next call to `snapshotPop`.

## pushShadow

snapshotPushShadow Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> [Shadow] | `shadow`: the first shadow specification
-> m () |

Applies a shadow to an image.

The image is recorded until the next call to `snapshotPop`.

## pushStroke

snapshotPushStroke Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Path | `path`: The path to stroke
-> Stroke | `stroke`: The stroke attributes
-> m () |

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

The image is recorded until the next call to `snapshotPop`.

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, `snapshotAppendStroke` may be more convenient.

Since: 4.14

## renderBackground

snapshotRenderBackground Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a, IsStyleContext b) |
=> a | `snapshot`: a `GtkSnapshot`
-> b | `context`: the style context that defines the background
-> Double | `x`: X origin of the rectangle
-> Double | `y`: Y origin of the rectangle
-> Double | `width`: rectangle width
-> Double | `height`: rectangle height
-> m () |

Deprecated: (Since version 4.10)

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

snapshotRenderFocus Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a, IsStyleContext b) |
=> a | `snapshot`: a `GtkSnapshot`
-> b | `context`: the style context that defines the focus ring
-> Double | `x`: X origin of the rectangle
-> Double | `y`: Y origin of the rectangle
-> Double | `width`: rectangle width
-> Double | `height`: rectangle height
-> m () |

Deprecated: (Since version 4.10)

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

snapshotRenderFrame Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a, IsStyleContext b) |
=> a | `snapshot`: a `GtkSnapshot`
-> b | `context`: the style context that defines the frame
-> Double | `x`: X origin of the rectangle
-> Double | `y`: Y origin of the rectangle
-> Double | `width`: rectangle width
-> Double | `height`: rectangle height
-> m () |

Deprecated: (Since version 4.10)

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

snapshotRenderInsertionCursor Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a, IsStyleContext b, IsLayout c) |
=> a | `snapshot`: snapshot to render to
-> b | `context`: a `GtkStyleContext`
-> Double | `x`: X origin
-> Double | `y`: Y origin
-> c | `layout`: the `PangoLayout` of the text
-> Int32 | `index`: the index in the `PangoLayout`
-> Direction | `direction`: the `PangoDirection` of the text
-> m () |

Deprecated: (Since version 4.10)

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

## renderLayout

snapshotRenderLayout Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a, IsStyleContext b, IsLayout c) |
=> a | `snapshot`: a `GtkSnapshot`
-> b | `context`: the style context that defines the text
-> Double | `x`: X origin of the rectangle
-> Double | `y`: Y origin of the rectangle
-> c | `layout`: the `PangoLayout` to render
-> m () |

Deprecated: (Since version 4.10)

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

snapshotRestore Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> m () |

Restores `snapshot` to the state saved by a preceding call to [method`snapshot`.save] and removes that state from the stack of saved states.

## rotate

snapshotRotate Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Float | `angle`: the rotation angle, in degrees (clockwise)
-> m () |

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.

To rotate around axes other than the Z axis, use `transformRotate3d`.

## rotate3d

snapshotRotate3d Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Float | `angle`: the rotation angle, in degrees (clockwise)
-> Vec3 | `axis`: The rotation axis
-> m () |

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

For a rotation in 2D space, use `transformRotate`.

## save

snapshotSave Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> m () |

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

When `snapshotRestore` is called, `snapshot` will be restored to the saved state.

Multiple calls to `snapshotSave` and `snapshotRestore` can be nested; each call to `gtk_snapshot_restore()` restores the state from the matching paired `gtk_snapshot_save()`.

It is necessary to clear all saved states with corresponding calls to `gtk_snapshot_restore()`.

## scale

snapshotScale Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Float | `factorX`: scaling factor on the X axis
-> Float | `factorY`: scaling factor on the Y axis
-> m () |

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

Use `snapshotScale3d` to scale in all 3 dimensions.

## scale3d

snapshotScale3d Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Float | `factorX`: scaling factor on the X axis
-> Float | `factorY`: scaling factor on the Y axis
-> Float | `factorZ`: scaling factor on the Z axis
-> m () |

Scales `snapshot`'s coordinate system by the given factors.

## toNode

snapshotToNode Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> m (Maybe RenderNode) | Returns: the constructed `GskRenderNode` or `Nothing` if there are no nodes to render.

Returns the render node that was constructed by `snapshot`.

Note that this function may return `Nothing` 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 `snapshot`. The only function that should be called after this is `objectUnref`.

## toPaintable

snapshotToPaintable Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Maybe Size | `size`: The size of the resulting paintable or `Nothing` to use the bounds of the snapshot
-> m (Maybe Paintable) | Returns: a new `GdkPaintable`

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

After calling this function, it is no longer possible to add more nodes to `snapshot`. The only function that should be called after this is `objectUnref`.

## transform

snapshotTransform Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Maybe Transform | `transform`: the transform to apply
-> m () |

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

## transformMatrix

snapshotTransformMatrix Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Matrix | `matrix`: the matrix to multiply the transform with
-> m () |

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

## translate

snapshotTranslate Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Point | `point`: the point to translate the snapshot by
-> m () |

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

## translate3d

snapshotTranslate3d Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnapshot a) |
=> a | `snapshot`: a `GtkSnapshot`
-> Point3D | `point`: the point to translate the snapshot by
-> m () |

Translates `snapshot`'s coordinate system by `point`.