package ocgtk
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054
doc/ocgtk.gtk/Ocgtk_gtk/Gtk/Wrappers/Snapshot/index.html
Module Wrappers.Snapshot
type t = [ `snapshot | `object_ ] Gobject.objval new_ : unit -> tCreate a new Snapshot
val translate_3d : t -> Ocgtk_graphene.Graphene.Wrappers.Point3_d.t -> unitTranslates @snapshot's coordinate system by @point.
val translate : t -> Ocgtk_graphene.Graphene.Wrappers.Point.t -> unitTranslates @snapshot's coordinate system by @point in 2-dimensional space.
val transform_matrix : t -> Ocgtk_graphene.Graphene.Wrappers.Matrix.t -> unitTransforms @snapshot's coordinate system with the given @matrix.
val transform : t -> Ocgtk_gsk.Gsk.Wrappers.Transform.t option -> unitTransforms @snapshot's coordinate system with the given @transform.
val to_paintable :
t ->
Ocgtk_graphene.Graphene.Wrappers.Size.t option ->
Ocgtk_gdk.Gdk.Wrappers.Paintable.t optionReturns 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 optionReturns 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 -> unitScales @snapshot's coordinate system by the given factors.
val scale : t -> float -> float -> unitScales @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 -> unitMakes 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 -> unitRotates @snapshot's coordinate system by @angle degrees around @axis.
For a rotation in 2D space, use method@Gsk.Transform.rotate.
val rotate : t -> float -> unitRotates @@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 -> unitRestores @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 ->
unitCreates 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 ->
unitDraws a text caret using @snapshot at the specified index of @layout.
val render_frame :
t ->
[ `style_context | `object_ ] Gobject.obj ->
float ->
float ->
float ->
float ->
unitCreates 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 ->
unitCreates 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 ->
unitCreates a render node for the CSS background according to @context, and appends it to the current node of @snapshot, without changing the current node.
val push_stroke :
t ->
Ocgtk_gsk.Gsk.Wrappers.Path.t ->
Ocgtk_gsk.Gsk.Wrappers.Stroke.t ->
unitStrokes 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 -> unitApplies 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 -> unitClips an image to a rounded rectangle.
The image is recorded until the next call to method@Gtk.Snapshot.pop.
val push_repeat :
t ->
Ocgtk_graphene.Graphene.Wrappers.Rect.t ->
Ocgtk_graphene.Graphene.Wrappers.Rect.t option ->
unitCreates 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 -> unitModifies 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 -> unitUntil 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().
val push_gl_shader :
t ->
Ocgtk_gsk.Gsk.Wrappers.Gl_shader.t ->
Ocgtk_graphene.Graphene.Wrappers.Rect.t ->
Glib_bytes.t ->
unitPush 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.
val push_fill :
t ->
Ocgtk_gsk.Gsk.Wrappers.Path.t ->
Ocgtk_gsk.Gsk.fillrule ->
unitFills 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 -> unitSnapshots 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.
val push_color_matrix :
t ->
Ocgtk_graphene.Graphene.Wrappers.Matrix.t ->
Ocgtk_graphene.Graphene.Wrappers.Vec4.t ->
unitModifies 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 -> unitClips an image to a rectangle.
The image is recorded until the next call to method@Gtk.Snapshot.pop.
val push_blur : t -> float -> unitBlurs an image.
The image is recorded until the next call to method@Gtk.Snapshot.pop.
val push_blend : t -> Ocgtk_gsk.Gsk.blendmode -> unitBlends 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 -> unitRemoves the top element from the stack of render nodes, and appends it to the node underneath it.
val perspective : t -> float -> unitApplies a perspective projection transform.
See method@Gsk.Transform.perspective for a discussion on the details.
val gl_shader_pop_texture : t -> unitRemoves 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.
val append_texture :
t ->
Ocgtk_gdk.Gdk.Wrappers.Texture.t ->
Ocgtk_graphene.Graphene.Wrappers.Rect.t ->
unitCreates 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.
val append_stroke :
t ->
Ocgtk_gsk.Gsk.Wrappers.Path.t ->
Ocgtk_gsk.Gsk.Wrappers.Stroke.t ->
Ocgtk_gdk.Gdk.Wrappers.Rgb_a.t ->
unitA 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.
val append_scaled_texture :
t ->
Ocgtk_gdk.Gdk.Wrappers.Texture.t ->
Ocgtk_gsk.Gsk.scalingfilter ->
Ocgtk_graphene.Graphene.Wrappers.Rect.t ->
unitCreates 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 ->
unitAppends a repeating radial gradient node with the given stops to @snapshot.
val append_repeating_linear_gradient :
t ->
Ocgtk_graphene.Graphene.Wrappers.Rect.t ->
Ocgtk_graphene.Graphene.Wrappers.Point.t ->
Ocgtk_graphene.Graphene.Wrappers.Point.t ->
Ocgtk_gsk.Gsk.Wrappers.Color_stop.t array ->
Gsize.t ->
unitAppends 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 ->
unitAppends 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 ->
unitAppends an outset shadow node around the box given by @outline.
val append_node : t -> Ocgtk_gsk.Gsk.Wrappers.Render_node.t -> unitAppends @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.
val append_linear_gradient :
t ->
Ocgtk_graphene.Graphene.Wrappers.Rect.t ->
Ocgtk_graphene.Graphene.Wrappers.Point.t ->
Ocgtk_graphene.Graphene.Wrappers.Point.t ->
Ocgtk_gsk.Gsk.Wrappers.Color_stop.t array ->
Gsize.t ->
unitAppends a linear gradient node with the given stops to @snapshot.
val append_layout :
t ->
Ocgtk_pango.Pango.Wrappers.Layout.t ->
Ocgtk_gdk.Gdk.Wrappers.Rgb_a.t ->
unitval append_inset_shadow :
t ->
Ocgtk_gsk.Gsk.Wrappers.Rounded_rect.t ->
Ocgtk_gdk.Gdk.Wrappers.Rgb_a.t ->
float ->
float ->
float ->
float ->
unitAppends an inset shadow into the box given by @outline.
val append_fill :
t ->
Ocgtk_gsk.Gsk.Wrappers.Path.t ->
Ocgtk_gsk.Gsk.fillrule ->
Ocgtk_gdk.Gdk.Wrappers.Rgb_a.t ->
unitA 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.
val append_conic_gradient :
t ->
Ocgtk_graphene.Graphene.Wrappers.Rect.t ->
Ocgtk_graphene.Graphene.Wrappers.Point.t ->
float ->
Ocgtk_gsk.Gsk.Wrappers.Color_stop.t array ->
Gsize.t ->
unitAppends a conic gradient node with the given stops to @snapshot.
val append_color :
t ->
Ocgtk_gdk.Gdk.Wrappers.Rgb_a.t ->
Ocgtk_graphene.Graphene.Wrappers.Rect.t ->
unitCreates 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.
val append_cairo :
t ->
Ocgtk_graphene.Graphene.Wrappers.Rect.t ->
Ocgtk_cairo.Cairo.Wrappers.Context.tCreates 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 ->
unitAppends a stroked border rectangle inside the given @outline.
The four sides of the border can have different widths and colors.