Gdk.DrawingContext

g GObject.Object GObject.Object Gdk.DrawingContext Gdk.DrawingContext GObject.Object->Gdk.DrawingContext

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

get_cairo_context ()

get_clip ()

get_window ()

is_valid ()

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

clip

cairo.Region

r/w/co

The clip region of the context

window

Gdk.Window

r/w/co

The window that created the context

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class Gdk.DrawingContext(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Gdk.DrawingContextClass

Gdk.DrawingContext is an object that represents the current drawing state of a Gdk.Window.

It’s possible to use a Gdk.DrawingContext to draw on a Gdk.Window via rendering API like Cairo or OpenGL.

A Gdk.DrawingContext can only be created by calling Gdk.Window.begin_draw_frame() and will be valid until a call to Gdk.Window.end_draw_frame().

Gdk.DrawingContext is available since GDK 3.22

get_cairo_context()[source]
Returns:

a Cairo context to be used to draw the contents of the Gdk.Window. The context is owned by the Gdk.DrawingContext and should not be destroyed

Return type:

cairo.Context

Retrieves a Cairo context to be used to draw on the Gdk.Window that created the Gdk.DrawingContext.

The returned context is guaranteed to be valid as long as the Gdk.DrawingContext is valid, that is between a call to Gdk.Window.begin_draw_frame() and Gdk.Window.end_draw_frame().

New in version 3.22.

get_clip()[source]
Returns:

a Cairo region

Return type:

cairo.Region or None

Retrieves a copy of the clip region used when creating the self.

New in version 3.22.

get_window()[source]
Returns:

a Gdk.Window

Return type:

Gdk.Window

Retrieves the window that created the drawing self.

New in version 3.22.

is_valid()[source]
Returns:

True if the context is valid

Return type:

bool

Checks whether the given Gdk.DrawingContext is valid.

New in version 3.22.

Property Details

Gdk.DrawingContext.props.clip
Name:

clip

Type:

cairo.Region

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The clip region applied to the drawing context.

New in version 3.22.

Gdk.DrawingContext.props.window
Name:

window

Type:

Gdk.Window

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The Gdk.Window that created the drawing context.

New in version 3.22.