Gdk.DrawContext¶
- Subclasses:
Methods¶
- Inherited:
- Structs:
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r/w/co |
|||
r/w/co |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Gdk.DrawContext(**kwargs)¶
- Bases:
- Abstract:
Yes
Base class for objects implementing different rendering methods.
GdkDrawContextis the base object used by contexts implementing different rendering methods, such as [class`Gdk`.CairoContext] or [class`Gdk`.GLContext]. It provides shared functionality between those contexts.You will always interact with one of those subclasses.
A
GdkDrawContextis always associated with a single toplevel surface.- begin_frame(region)[source]¶
- Parameters:
region (
cairo.Region) – minimum region that should be drawn
Indicates that you are beginning the process of redrawing region on the self's surface.
Calling this function begins a drawing operation using self on the surface that self was created from. The actual requirements and guarantees for the drawing operation vary for different implementations of drawing, so a [class`Gdk`.CairoContext] and a [class`Gdk`.GLContext] need to be treated differently.
A call to this function is a requirement for drawing and must be followed by a call to [method`Gdk`.DrawContext.end_frame], which will complete the drawing operation and ensure the contents become visible on screen.
Note that the region passed to this function is the minimum region that needs to be drawn and depending on implementation, windowing system and hardware in use, it might be necessary to draw a larger region. Drawing implementation must use [method`Gdk`.DrawContext.get_frame_region] to query the region that must be drawn.
When using GTK, the widget system automatically places calls to
Gdk.DrawContext.begin_frame() andGdk.DrawContext.end_frame() via the use of `GskRenderer <../gsk4/class.Renderer.html>`__s, so application code does not need to call these functions explicitly.Deprecated since version 4.16: Drawing directly to the surface is no longer recommended. Use
GskRenderNodeandGskRenderer.
- end_frame()[source]¶
Ends a drawing operation started with
Gdk.DrawContext.begin_frame().This makes the drawing available on screen. See [method`Gdk`.DrawContext.begin_frame] for more details about drawing.
When using a [class`Gdk`.GLContext], this function may call
glFlush()implicitly before returning; it is not recommended to callglFlush()explicitly before calling this function.Deprecated since version 4.16: Drawing directly to the surface is no longer recommended. Use
GskRenderNodeandGskRenderer.
- get_display()[source]¶
- Returns:
the
GdkDisplay- Return type:
Gdk.DisplayorNone
Retrieves the
GdkDisplaythe self is created for
- get_frame_region()[source]¶
- Returns:
a Cairo region
- Return type:
cairo.RegionorNone
Retrieves the region that is currently being repainted.
After a call to [method`Gdk`.DrawContext.begin_frame] this function will return a union of the region passed to that function and the area of the surface that the self determined needs to be repainted.
If self is not in between calls to [method`Gdk`.DrawContext.begin_frame] and [method`Gdk`.DrawContext.end_frame],
Nonewill be returned.Deprecated since version 4.16: Drawing directly to the surface is no longer recommended. Use
GskRenderNodeandGskRenderer.
- get_surface()[source]¶
- Returns:
a
GdkSurface- Return type:
Gdk.SurfaceorNone
Retrieves the surface that self is bound to.
- is_in_frame()[source]¶
- Returns:
Trueif the context is between [method`Gdk`.DrawContext.begin_frame] and [method`Gdk`.DrawContext.end_frame] calls.- Return type:
Returns
Trueif self is in the process of drawing to its surface.This is the case between calls to [method`Gdk`.DrawContext.begin_frame] and [method`Gdk`.DrawContext.end_frame]. In this situation, drawing commands may be effecting the contents of the self's surface.
Deprecated since version 4.16: Drawing directly to the surface is no longer recommended. Use
GskRenderNodeandGskRenderer.
Property Details¶
- Gdk.DrawContext.props.display¶
- Name:
display- Type:
- Default Value:
- Flags:
The
GdkDisplayused to create theGdkDrawContext.
- Gdk.DrawContext.props.surface¶
- Name:
surface- Type:
- Default Value:
- Flags:
The
GdkSurfacethe context is bound to.