Package: gdk

Function gdk-window-begin-paint-region

Lambda List

gdk-window-begin-paint-region (window region)

Arguments

window -- a gdk-window object
region -- a cairo-region-t structue you intend to draw to

Details

Indicates that you are beginning the process of redrawing region. 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-paint, the backing store will be copied to window, making it visible onscreen. 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-paint. If you draw to window directly without calling the function gdk-window-begin-paint-region, the user may see flicker as individual drawing operations are performed in sequence. The clipping and background-initializing features of the function gdk-window-begin-paint-region are conveniences for the programmer, so you can avoid doing that work yourself.

When using GTK, the widget system automatically places calls to the functions gdk-window-begin-paint-region and gdk-window-end-paint around emissions of the "expose-event" signal. That is, if you are writing an expose event handler, you can assume that the exposed area in gdk-event-expose has already been cleared to the window background, is already set as the clip region, and already has a backing store. Therefore in most cases, application code need not call the function gdk-window-begin-paint-region. You can disable the automatic calls around expose events on a widget-by-widget basis by calling the function gtk-widget-double-buffered.

If you call this function multiple times before calling the matching function gdk-window-end-paint, the backing stores are pushed onto a stack. The function gdk-window-end-paint copies the topmost backing store onscreen, subtracts the topmost region from all other regions in the stack, and pops the stack. All drawing operations affect only the topmost backing store in the stack. One matching call to the function gdk-window-end-paint is required for each call to the function gdk-window-begin-paint-region.

Warning

The function gdk-window-begin-paint-region has been deprecated since version 3.22 and should not be used in newly written code. Use the function gdk-window-begin-draw-frame instead.
 

See also

2020-9-23