1.20 <GdkDrawContext>

Class: <GdkDrawContext>

It derives from <GObject>.

Base class for objects implementing different rendering methods.

<GdkDrawContext> is the base object used by contexts implementing different rendering methods, such as <GdkCairoContext> or <GdkGLContext>. It provides shared functionality between those contexts.

You will always interact with one of those subclasses.

A <GdkDrawContext> is always associated with a single toplevel surface.

Properties

Property: draw-context:display self

The <GdkDisplay> used to create the <GdkDrawContext>.

Its value is a <GdkDisplay>, or #f.

It can only be set when the object is made, with #:display.

Property: draw-context:surface self

The <GdkSurface> the context is bound to.

Its value is a <GdkSurface>, or #f.

It can only be set when the object is made, with #:surface.

Procedures

Method: draw-context:begin-frame self region
Method: begin-frame self region

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 <GdkCairoContext> and a <GdkGLContext> need to be treated differently.

A call to this function is a requirement for drawing and must be followed by a call to draw-context: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 draw-context:get-frame-region to query the region that must be drawn.

When using GTK, the widget system automatically places calls to draw-context:begin-frame and draw-context:end-frame via the use of GskRenderers, so application code does not need to call these functions explicitly.

self

Passed: a <GdkDrawContext>.

the <GdkDrawContext> used to draw the frame. The context must have a surface.

region

Passed: a <CairoRegion>.

minimum region that should be drawn

Method: draw-context:end-frame self
Method: end-frame self

Ends a drawing operation started with draw-context:begin-frame.

This makes the drawing available on screen. See draw-context:begin-frame for more details about drawing.

When using a <GdkGLContext>, this function may call glFlush() implicitly before returning; it is not recommended to call glFlush() explicitly before calling this function.

self

Passed: a <GdkDrawContext>.

a <GdkDrawContext>

Method: draw-context:get-display self ⇒ %return
Method: get-display self ⇒ %return

Retrieves the <GdkDisplay> the self is created for

self

Passed: a <GdkDrawContext>.

a <GdkDrawContext>

%return

Returned: a <GdkDisplay>, or #f.

the <GdkDisplay>

Method: draw-context:get-frame-region self ⇒ %return
Method: get-frame-region self ⇒ %return

Retrieves the region that is currently being repainted.

After a call to draw-context: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 draw-context:begin-frame and draw-context:end-frame, #f will be returned.

self

Passed: a <GdkDrawContext>.

a <GdkDrawContext>

%return

Returned: a <CairoRegion>, or #f.

a Cairo region

Method: draw-context:get-surface self ⇒ %return
Method: get-surface self ⇒ %return

Retrieves the surface that self is bound to.

self

Passed: a <GdkDrawContext>.

a <GdkDrawContext>

%return

Returned: a <GdkSurface>, or #f.

a <GdkSurface>

Method: draw-context:is-in-frame? self ⇒ %return
Method: is-in-frame? self ⇒ %return

Returns #t if self is in the process of drawing to its surface.

This is the case between calls to draw-context:begin-frame and draw-context:end-frame. In this situation, drawing commands may be effecting the contents of the self’s surface.

self

Passed: a <GdkDrawContext>.

a <GdkDrawContext>

%return

Returned: a boolean.

#t if the context is between draw-context:begin-frame and draw-context:end-frame calls.