begin_draw_frame


Description:

[ Version ( since = "3.22" ) ]
public unowned DrawingContext begin_draw_frame (Region region)

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

If this is a top level Window, 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 this. Then, all drawing operations performed on this will be diverted to the backing store. When you call gdk_window_end_frame, the contents of the backing store will be copied to this, making it visible on screen. Only the part of this 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 end_draw_frame. If you draw to this directly without calling 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 begin_draw_frame and end_draw_frame around emissions of the `GtkWidget:GdkWindow: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 begin_draw_frame explicitly.

Parameters:

this

a Window

region

a Cairo region

Returns:

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