package ocgtk

  1. Overview
  2. Docs
OCaml bindings for GTK 4

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.1-preview2.tar.gz
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054

doc/ocgtk.gdk/Ocgtk_gdk/Gdk/Wrappers/Draw_context/index.html

Module Wrappers.Draw_context

type t = [ `draw_context | `object_ ] Gobject.obj
val is_in_frame : t -> bool

Returns %TRUE if @context is in the process of drawing to its surface.

This is the case between calls to method@Gdk.DrawContext.begin_frame and method@Gdk.DrawContext.end_frame. In this situation, drawing commands may be effecting the contents of the @context's surface.

val get_surface : t -> [ `surface | `object_ ] Gobject.obj option

Retrieves the surface that @context is bound to.

val get_frame_region : t -> Ocgtk_cairo.Cairo.Wrappers.Region.t option

Retrieves the region that is currently being repainted.

After a call to method@Gdk.DrawContext.begin_frame this function will return a union of the region passed to that function and the area of the surface that the @context determined needs to be repainted.

If @context is not in between calls to method@Gdk.DrawContext.begin_frame and method@Gdk.DrawContext.end_frame, %NULL will be returned.

val get_display : t -> [ `display | `object_ ] Gobject.obj option

Retrieves the `GdkDisplay` the @context is created for

val end_frame : t -> unit

Ends a drawing operation started with gdk_draw_context_begin_frame().

This makes the drawing available on screen. See method@Gdk.DrawContext.begin_frame for more details about drawing.

When using a class@Gdk.GLContext, this function may call `glFlush()` implicitly before returning; it is not recommended to call `glFlush()` explicitly before calling this function.

val begin_frame : t -> Ocgtk_cairo.Cairo.Wrappers.Region.t -> unit

Indicates that you are beginning the process of redrawing @region on the @context's surface.

Calling this function begins a drawing operation using @context on the surface that @context was created from. The actual requirements and guarantees for the drawing operation vary for different implementations of drawing, so a class@Gdk.CairoContext and a class@Gdk.GLContext need to be treated differently.

A call to this function is a requirement for drawing and must be followed by a call to method@Gdk.DrawContext.end_frame, which will complete the drawing operation and ensure the contents become visible on screen.

Note that the @region passed to this function is the minimum region that needs to be drawn and depending on implementation, windowing system and hardware in use, it might be necessary to draw a larger region. Drawing implementation must use method@Gdk.DrawContext.get_frame_region to query the region that must be drawn.

When using GTK, the widget system automatically places calls to gdk_draw_context_begin_frame() and gdk_draw_context_end_frame() via the use of GskRenderer(../gsk4/class.Renderer.html)s, so application code does not need to call these functions explicitly.