Basics
Guides
API Reference
Basics
Guides
API Reference
[17:7] extends: object
Base class for objects implementing different rendering methods.
GdkDrawContext is the base object used by contexts implementing different
rendering methods, such as [class@Gdk.CairoContext] or [class@Gdk.GLContext].
It provides shared functionality between those contexts. You will always
interact with one of those subclasses. A GdkDrawContext is always
associated with a single toplevel surface.
DrawContext (Handle = null)
Creates a new
DrawContextby wrapping a native handle or another wrapper.
Handle is the native handle or another wrapper whose handle to adopt.toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.asObject ()
Wraps this handle as
Object.
A Object object.begin_frame (object region)
Indicates that you are beginning the process of redrawing @region on the
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 thepassed 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 GskRenderers, so application code does not need to call these functions explicitly.region is minimum region that should be drawn.None.end_frame ()
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 callglFlush()explicitly before calling this function.
None.get_display ()
Retrieves the
GdkDisplaythe @context is created for
get_frame_region ()
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
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.get_surface ()
Retrieves the surface that @context is bound to.
is_in_frame ()
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.
[194:14] static extends: object
Generated metadata helpers for DrawContext class surfaces.
properties ()
Returns property metadata for
DrawContext.
A list.
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.