pub trait DrawContextExt: 'static {
    fn begin_frame(&self, region: &Region);
    fn end_frame(&self);
    fn display(&self) -> Option<Display>;
    fn surface(&self) -> Option<Surface>;
    fn is_in_frame(&self) -> bool;
Expand description

Required Methods

Indicates that you are beginning the process of redrawing @region on the @self’s surface.

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

A call to this function is a requirement for drawing and must be followed by a call to 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 DrawContextExtManual::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 Gsk::Renderers, so application code does not need to call these functions explicitly.


minimum region that should be drawn

Ends a drawing operation started with gdk_draw_context_begin_frame().

This makes the drawing available on screen. See begin_frame() for more details about drawing.

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

Retrieves the Display the @self is created for


the Display

Retrieves the surface that @self is bound to.


a Surface

Returns true if @self is in the process of drawing to its surface.

This is the case between calls to begin_frame() and end_frame(). In this situation, drawing commands may be effecting the contents of the @self’s surface.


true if the context is between begin_frame() and end_frame() calls.