Method

GdkWindowbegin_draw_frame

since: 3.22

Declaration [src]

GdkDrawingContext*
gdk_window_begin_draw_frame (
  GdkWindow* window,
  const cairo_region_t* region
)

Description [src]

Indicates that you are beginning the process of redrawing region on window, and provides you with a GdkDrawingContext.

If window is a top level GdkWindow, backed by a native window implementation, a backing store (offscreen buffer) large enough to contain region will be created. The backing store will be initialized with the background color or background surface for window. Then, all drawing operations performed on window will be diverted to the backing store. When you call gdk_window_end_frame(), the contents of the backing store will be copied to window, making it visible on screen. Only the part of window contained in region will be modified; that is, drawing operations are clipped to region.

The net result of all this is to remove flicker, because the user sees the finished product appear all at once when you call gdk_window_end_draw_frame(). If you draw to window directly without calling gdk_window_begin_draw_frame(), the user may see flicker as individual drawing operations are performed in sequence.

When using GTK+, the widget system automatically places calls to gdk_window_begin_draw_frame() and gdk_window_end_draw_frame() around emissions of the GtkWidget::draw signal. That is, if you’re drawing the contents of the widget yourself, you can assume that the widget has a cleared background, is already set as the clip region, and already has a backing store. Therefore in most cases, application code in GTK does not need to call gdk_window_begin_draw_frame() explicitly.

Available since: 3.22

Parameters

region

Type: cairo_region_t

A Cairo region.

The data is owned by the caller of the method.

Return value

Type: GdkDrawingContext

A GdkDrawingContext context that should be used to draw the contents of the window; the returned context is owned by GDK.

The returned data is owned by the instance.