Package: gdk

Function gdk-window-begin-draw-frame

Lambda List

gdk-window-begin-draw-frame (window region)

Arguments

window -- a gdk-window object
region -- a cairo-region-t structure

Return Value

A gdk-drawing-context object that should be used to draw the contents of the window, the returned context is owned by GDK.

Details

Indicates that you are beginning the process of redrawing region on window, and provides you with a gdk-drawing-context object.

If window is a toplevel gdk-window object, 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 the function gdk-window-end-draw-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 the function gdk-window-end-draw-frame. If you draw to window directly without calling the function 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 the functions gdk-window-begin-draw-frame and gdk-window-end-draw-frame around emissions of the "draw" signal. That is, if you are 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 the function gdk-window-begin-draw-frame explicitly.

Since 3.22
 

See also

2020-9-23