Creates a Cairo context for drawing to window.

Note that calling cairo_reset_clip() on the resulting cairo_t will produce undefined results, so avoid it at all costs.

Typically, this function is used to draw on a gdk.Window out of the paint cycle of the toolkit; this should be avoided, as it breaks various assumptions and optimizations.

If you are drawing on a native gdk.Window in response to a GDK_EXPOSE event you should use Window.beginDrawFrame and DrawingContext.getCairoContext instead. GTK will automatically do this for you when drawing a widget.



window Window

Return Value

Type: Context

A newly created Cairo context. Free with cairo_destroy() when you are done drawing.

Detailed Description