| Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria |
| Safe Haskell | None |
| Language | Haskell2010 |
GI.Gtk.Objects.Snapshot
Contents
- Exported types
- Methods
- Overloaded methods
- appendBorder
- appendCairo
- appendColor
- appendInsetShadow
- appendLayout
- appendLinearGradient
- appendNode
- appendOutsetShadow
- appendRepeatingLinearGradient
- appendTexture
- new
- perspective
- pop
- pushBlend
- pushBlur
- pushClip
- pushColorMatrix
- pushCrossFade
- pushOpacity
- pushRepeat
- pushRoundedClip
- pushShadow
- renderBackground
- renderFocus
- renderFrame
- renderInsertionCursor
- renderLayout
- restore
- rotate
- rotate3d
- save
- scale
- scale3d
- toNode
- toPaintable
- transform
- transformMatrix
- translate
- translate3d
Description
GtkSnapshot is an auxiliary object that assists in creating GskRenderNodes
in the PaintableInterface.snapshot() vfunc. 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 snapshotPop
to change the current node.
The typical way to obtain a GtkSnapshot object is as an argument to
the WidgetClass.snapshot() vfunc. If you need to create your own GtkSnapshot,
use snapshotNew.
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 ()
- 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 ()
- snapshotAppendRepeatingLinearGradient :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Rect -> Point -> Point -> [ColorStop] -> m ()
- snapshotAppendTexture :: (HasCallStack, MonadIO m, IsSnapshot a, IsTexture b) => a -> b -> Rect -> 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 ()
- snapshotPushCrossFade :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Double -> 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 -> Word64 -> 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 RenderNode
- snapshotToPaintable :: (HasCallStack, MonadIO m, IsSnapshot a) => a -> Maybe Size -> m 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
Memory-managed wrapper type.
Instances
| Eq Snapshot Source # | |
| GObject Snapshot Source # | |
Defined in GI.Gtk.Objects.Snapshot | |
| ManagedPtrNewtype Snapshot Source # | |
Defined in GI.Gtk.Objects.Snapshot Methods toManagedPtr :: Snapshot -> ManagedPtr Snapshot | |
| TypedObject Snapshot Source # | |
Defined in GI.Gtk.Objects.Snapshot Methods glibType :: IO GType | |
| IsGValue Snapshot Source # | Convert |
Defined in GI.Gtk.Objects.Snapshot | |
| HasParentTypes Snapshot Source # | |
Defined in GI.Gtk.Objects.Snapshot | |
| type ParentTypes Snapshot Source # | |
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
| (GObject o, IsDescendantOf Snapshot o) => IsSnapshot o Source # | |
Defined in GI.Gtk.Objects.Snapshot | |
toSnapshot :: (MonadIO m, IsSnapshot o) => o -> m Snapshot Source #
Methods
Overloaded methods
appendBorder
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> RoundedRect |
|
| -> [Float] |
|
| -> [RGBA] |
|
| -> m () |
Appends a stroked border rectangle inside the given outline. The
4 sides of the border can have different widths and colors.
appendCairo
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> Rect |
|
| -> m Context | Returns: a cairo_t suitable for drawing the contents of the newly created render node |
Creates a new render node and appends it to the current render
node of snapshot, without changing the current node.
appendColor
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> RGBA |
|
| -> Rect |
|
| -> 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.
appendInsetShadow
snapshotAppendInsetShadow Source #
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> RoundedRect |
|
| -> RGBA |
|
| -> Float |
|
| -> Float |
|
| -> Float |
|
| -> Float |
|
| -> m () |
Appends an inset shadow into the box given by outline.
appendLayout
snapshotAppendLayout :: (HasCallStack, MonadIO m, IsSnapshot a, IsLayout b) => a -> b -> RGBA -> m () Source #
No description available in the introspection data.
appendLinearGradient
snapshotAppendLinearGradient Source #
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> Rect |
|
| -> Point |
|
| -> Point |
|
| -> [ColorStop] |
|
| -> m () |
Appends a linear gradient node with the given stops to snapshot.
appendNode
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a, IsRenderNode b) | |
| => a |
|
| -> b |
|
| -> 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 |
|
| -> RoundedRect |
|
| -> RGBA |
|
| -> Float |
|
| -> Float |
|
| -> Float |
|
| -> Float |
|
| -> m () |
Appends an outset shadow node around the box given by outline.
appendRepeatingLinearGradient
snapshotAppendRepeatingLinearGradient Source #
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> Rect |
|
| -> Point |
|
| -> Point |
|
| -> [ColorStop] |
|
| -> m () |
Appends a repeating linear gradient node with the given stops to snapshot.
appendTexture
snapshotAppendTexture Source #
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a, IsTexture b) | |
| => a |
|
| -> b |
|
| -> Rect |
|
| -> m () |
Creates a new render node drawing the texture into the given bounds and appends it
to the current render node of snapshot.
new
Arguments
| :: (HasCallStack, MonadIO m) | |
| => m Snapshot | Returns: a newly-allocated |
Creates a new GtkSnapshot.
perspective
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> Float |
|
| -> m () |
Applies a perspective projection transform.
See transformPerspective for a discussion on the details.
pop
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> m () |
Removes the top element from the stack of render nodes, and appends it to the node underneath it.
pushBlend
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> BlendMode |
|
| -> m () |
Blends together 2 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 2 subsequent calls to snapshotPop.
pushBlur
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> Double |
|
| -> m () |
Blurs an image.
The image is recorded until the next call to snapshotPop.
pushClip
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> Rect |
|
| -> 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 |
|
| -> Matrix |
|
| -> Vec4 |
|
| -> m () |
Modifies the colors of an image by applying an affine transformation in RGB space.
The image is recorded until the next call to snapshotPop.
pushCrossFade
snapshotPushCrossFade Source #
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> Double |
|
| -> 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 2 calls to snapshotPop.
pushOpacity
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> Double |
|
| -> m () |
Modifies the opacity of an image.
The image is recorded until the next call to snapshotPop.
pushRepeat
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> Rect |
|
| -> Maybe Rect |
|
| -> 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 |
|
| -> RoundedRect |
|
| -> m () |
Clips an image to a rounded rectangle.
The image is recorded until the next call to snapshotPop.
pushShadow
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> Shadow |
|
| -> Word64 |
|
| -> m () |
Applies a shadow to an image.
The image is recorded until the next call to snapshotPop.
renderBackground
snapshotRenderBackground Source #
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a, IsStyleContext b) | |
| => a |
|
| -> b |
|
| -> Double |
|
| -> Double |
|
| -> Double |
|
| -> Double |
|
| -> m () |
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
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a, IsStyleContext b) | |
| => a |
|
| -> b |
|
| -> Double |
|
| -> Double |
|
| -> Double |
|
| -> Double |
|
| -> m () |
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
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a, IsStyleContext b) | |
| => a |
|
| -> b |
|
| -> Double |
|
| -> Double |
|
| -> Double |
|
| -> Double |
|
| -> m () |
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 |
|
| -> b |
|
| -> Double |
|
| -> Double |
|
| -> c |
|
| -> Int32 |
|
| -> Direction |
|
| -> m () |
Draws a text caret using snapshot at the specified index of layout.
renderLayout
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a, IsStyleContext b, IsLayout c) | |
| => a |
|
| -> b |
|
| -> Double |
|
| -> Double |
|
| -> c |
|
| -> m () |
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
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> m () |
Restores snapshot to the state saved by a preceding call to
snapshotSave and removes that state from the stack of
saved states.
rotate
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> Float |
|
| -> m () |
Rotates @snapshot's coordinate system by angle degrees in 2D space -
or in 3D speak, rotates around the z axis.
rotate3d
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> Float |
|
| -> Vec3 |
|
| -> m () |
Rotates snapshot's coordinate system by angle degrees around axis.
For a rotation in 2D space, use transformRotate.
save
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> m () |
Makes a copy of the current state of snapshot and saves it
on an internal stack of saved states for snapshot. When
snapshotRestore is called, snapshot will be restored to
the saved state. Multiple calls to snapshotSave and
snapshotRestore can be nested; each call to
snapshotRestore restores the state from the matching paired
snapshotSave.
It is necessary to clear all saved states with corresponding calls
to snapshotRestore.
scale
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> Float |
|
| -> Float |
|
| -> m () |
Scales snapshot's coordinate system in 2-dimensional space by
the given factors.
Use snapshotScale3d to scale in all 3 dimensions.
scale3d
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> Float |
|
| -> Float |
|
| -> Float |
|
| -> m () |
Scales snapshot's coordinate system by the given factors.
toNode
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> m RenderNode | Returns: the constructed |
Returns 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.
toPaintable
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> Maybe Size |
|
| -> m Paintable | Returns: a new |
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
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> Maybe Transform |
|
| -> m () |
Transforms snapshot's coordinate system with the given transform.
transformMatrix
snapshotTransformMatrix Source #
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> Matrix |
|
| -> m () |
Transforms snapshot's coordinate system with the given matrix.
translate
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> Point |
|
| -> m () |
Translates snapshot's coordinate system by point in 2-dimensional space.
translate3d
Arguments
| :: (HasCallStack, MonadIO m, IsSnapshot a) | |
| => a |
|
| -> Point3D |
|
| -> m () |
Translates snapshot's coordinate system by point.