package ocgtk

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Wrappers.Snapshot

type t = [ `snapshot | `object_ ] Gobject.obj
val new_ : unit -> t

Create a new Snapshot

val translate_3d : t -> Ocgtk_graphene.Graphene.Wrappers.Point3_d.t -> unit

Translates @snapshot's coordinate system by @point.

val translate : t -> Ocgtk_graphene.Graphene.Wrappers.Point.t -> unit

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

val transform_matrix : t -> Ocgtk_graphene.Graphene.Wrappers.Matrix.t -> unit

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

val transform : t -> Ocgtk_gsk.Gsk.Wrappers.Transform.t option -> unit

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

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 method@GObject.Object.unref.

val to_node : t -> Ocgtk_gsk.Gsk.Wrappers.Render_node.t option

Returns the render node that was constructed by @snapshot.

Note that this function may return %NULL 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 method@GObject.Object.unref.

val scale_3d : t -> float -> float -> float -> unit

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

val scale : t -> float -> float -> unit

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

Use method@Gtk.Snapshot.scale_3d to scale in all 3 dimensions.

val save : t -> unit

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

When method@Gtk.Snapshot.restore is called, @snapshot will be restored to the saved state.

Multiple calls to method@Gtk.Snapshot.save and method@Gtk.Snapshot.restore 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()`.

val rotate_3d : t -> float -> Ocgtk_graphene.Graphene.Wrappers.Vec3.t -> unit

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

For a rotation in 2D space, use method@Gsk.Transform.rotate.

val rotate : t -> float -> unit

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 method@Gsk.Transform.rotate_3d.

val restore : t -> unit

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

val render_layout : t -> [ `style_context | `object_ ] Gobject.obj -> float -> float -> Ocgtk_pango.Pango.Wrappers.Layout.t -> unit

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.

val render_insertion_cursor : t -> [ `style_context | `object_ ] Gobject.obj -> float -> float -> Ocgtk_pango.Pango.Wrappers.Layout.t -> int -> Ocgtk_pango.Pango.direction -> unit

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

val render_frame : t -> [ `style_context | `object_ ] Gobject.obj -> float -> float -> float -> float -> unit

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.

val render_focus : t -> [ `style_context | `object_ ] Gobject.obj -> float -> float -> float -> float -> unit

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.

val render_background : t -> [ `style_context | `object_ ] Gobject.obj -> float -> float -> float -> float -> unit

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.

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

The image is recorded until the next call to method@Gtk.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, method@Gtk.Snapshot.append_stroke may be more convenient.

val push_shadow : t -> Ocgtk_gsk.Gsk.Wrappers.Shadow.t array -> Gsize.t -> unit

Applies a shadow to an image.

The image is recorded until the next call to method@Gtk.Snapshot.pop.

val push_rounded_clip : t -> Ocgtk_gsk.Gsk.Wrappers.Rounded_rect.t -> unit

Clips an image to a rounded rectangle.

The image is recorded until the next call to method@Gtk.Snapshot.pop.

Creates a node that repeats the child node.

The child is recorded until the next call to method@Gtk.Snapshot.pop.

val push_opacity : t -> float -> unit

Modifies the opacity of an image.

The image is recorded until the next call to method@Gtk.Snapshot.pop.

val push_mask : t -> Ocgtk_gsk.Gsk.maskmode -> unit

Until the first call to method@Gtk.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 method@Gtk.Snapshot.pop.

Calling this function requires 2 subsequent calls to gtk_snapshot_pop().

Push a class@Gsk.GLShaderNode.

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

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 method@Gsk.GLShader.format_args or struct@Gsk.ShaderArgsBuilder.

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 method@Gsk.GLShader.compile to ensure the @shader will work for the renderer before using it.

If the shader requires textures (see method@Gsk.GLShader.get_n_textures), then it is expected that you call method@Gtk.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 method@Gtk.Snapshot.pop.

If you want to use pre-existing textures as input to the shader rather than rendering new ones, use method@Gtk.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 class@Gsk.GLShader.

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 method@Gtk.Snapshot.pop.

If you want to fill the path with a color, method@Gtk.Snapshot.append_fill may be more convenient.

val push_cross_fade : t -> float -> unit

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

Until the first call to method@Gtk.Snapshot.pop, the start image will be snapshot. After that call, the end image will be recorded until the second call to method@Gtk.Snapshot.pop.

Calling this function requires two subsequent calls to method@Gtk.Snapshot.pop.

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 method@Gtk.Snapshot.pop.

val push_clip : t -> Ocgtk_graphene.Graphene.Wrappers.Rect.t -> unit

Clips an image to a rectangle.

The image is recorded until the next call to method@Gtk.Snapshot.pop.

val push_blur : t -> float -> unit

Blurs an image.

The image is recorded until the next call to method@Gtk.Snapshot.pop.

val push_blend : t -> Ocgtk_gsk.Gsk.blendmode -> unit

Blends together two images with the given blend mode.

Until the first call to method@Gtk.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 method@Gtk.Snapshot.pop.

Calling this function requires two subsequent calls to method@Gtk.Snapshot.pop.

val pop : t -> unit

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

val perspective : t -> float -> unit

Applies a perspective projection transform.

See method@Gsk.Transform.perspective for a discussion on the details.

val gl_shader_pop_texture : t -> unit

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

This must be called the same number of times as the number of textures is needed for the shader in method@Gtk.Snapshot.push_gl_shader.

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 method@Gtk.Snapshot.append_scaled_texture if you need other filtering, such as nearest-neighbour.

A convenience method to stroke a path with a color.

See method@Gtk.Snapshot.push_stroke if you need to stroke a path with more complex content than a color.

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 method@Gtk.Snapshot.append_texture, this function provides control about how the filter that is used when scaling.

val append_repeating_radial_gradient : t -> Ocgtk_graphene.Graphene.Wrappers.Rect.t -> Ocgtk_graphene.Graphene.Wrappers.Point.t -> float -> float -> float -> float -> Ocgtk_gsk.Gsk.Wrappers.Color_stop.t array -> Gsize.t -> unit

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

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

val append_radial_gradient : t -> Ocgtk_graphene.Graphene.Wrappers.Rect.t -> Ocgtk_graphene.Graphene.Wrappers.Point.t -> float -> float -> float -> float -> Ocgtk_gsk.Gsk.Wrappers.Color_stop.t array -> Gsize.t -> unit

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

val append_outset_shadow : t -> Ocgtk_gsk.Gsk.Wrappers.Rounded_rect.t -> Ocgtk_gdk.Gdk.Wrappers.Rgb_a.t -> float -> float -> float -> float -> unit

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

val append_node : t -> Ocgtk_gsk.Gsk.Wrappers.Render_node.t -> unit

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.

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

val append_inset_shadow : t -> Ocgtk_gsk.Gsk.Wrappers.Rounded_rect.t -> Ocgtk_gdk.Gdk.Wrappers.Rgb_a.t -> float -> float -> float -> float -> unit

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

A convenience method to fill a path with a color.

See method@Gtk.Snapshot.push_fill if you need to fill a path with more complex content than a color.

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

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.

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

val append_border : t -> Ocgtk_gsk.Gsk.Wrappers.Rounded_rect.t -> float array -> Ocgtk_gdk.Gdk.Wrappers.Rgb_a.t array -> unit

Appends a stroked border rectangle inside the given @outline.

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