cairoCreate

Creates a Cairo context for drawing to window.

Note that calling [cairo.context.Context.resetClip] on the resulting #cairo_t will produce undefined results, so avoid it at all costs.

Typically, this function is used to draw on a #GdkWindow 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 #GdkWindow in response to a [gdk.types.EventType.Expose] event you should use [gdk.window.Window.beginDrawFrame] and [gdk.drawing_context.DrawingContext.getCairoContext] instead. GTK will automatically do this for you when drawing a widget.

Parameters

windowa #GdkWindow

Returns

A newly created Cairo context. Free with

[cairo.global.destroy] when you are done drawing.

Deprecated

Use [gdk.window.Window.beginDrawFrame] and

[gdk.drawing_context.DrawingContext.getCairoContext] instead