gi-gdk-4.0.2: Gdk bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Gdk.Objects.DrawContext

Description

DrawContext is the base object used by contexts implementing different rendering methods, such as GLContext or VulkanContext. It provides shared functionality between those contexts.

You will always interact with one of those s.ubclasses.

A GdkDrawContext is always associated with a single toplevel surface.

Synopsis

Exported types

newtype DrawContext Source #

Memory-managed wrapper type.

class (GObject o, IsDescendantOf DrawContext o) => IsDrawContext o Source #

Type class for types which can be safely cast to DrawContext, for instance with toDrawContext.

Instances

Instances details
(GObject o, IsDescendantOf DrawContext o) => IsDrawContext o Source # 
Instance details

Defined in GI.Gdk.Objects.DrawContext

toDrawContext :: (MonadIO m, IsDrawContext o) => o -> m DrawContext Source #

Cast to DrawContext, for types for which this is known to be safe. For general casts, use castTo.

Methods

Overloaded methods

beginFrame

drawContextBeginFrame Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrawContext a) 
=> a

context: the context used to draw the frame

-> Region

region: minimum region that should be drawn

-> m () 

Indicates that you are beginning the process of redrawing region on the context's surface.

Calling this function begins a drawing operation using context on the surface that context was created from. The actual requirements and guarantees for the drawing operation vary for different implementations of drawing, so a CairoContext and a GLContext need to be treated differently.

A call to this function is a requirement for drawing and must be followed by a call to drawContextEndFrame, 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 drawContextGetFrameRegion to query the region that must be drawn.

When using GTK+, the widget system automatically places calls to drawContextBeginFrame and drawContextEndFrame via the use of GskRenderers, so application code does not need to call these functions explicitly.

endFrame

drawContextEndFrame Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrawContext a) 
=> a

context: a DrawContext

-> m () 

Ends a drawing operation started with drawContextBeginFrame and makes the drawing available on screen. See that function for more details about drawing.

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

getDisplay

drawContextGetDisplay Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrawContext a) 
=> a

context: a DrawContext

-> m (Maybe Display)

Returns: a Display or Nothing

Retrieves the Display the context is created for

getFrameRegion

drawContextGetFrameRegion Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrawContext a) 
=> a

context: a DrawContext

-> m (Maybe Region)

Returns: a Cairo region or Nothing if not drawing a frame.

Retrieves the region that is currently in the process of being repainted.

After a call to drawContextBeginFrame this function will return a union of the region passed to that function and the area of the surface that the context determined needs to be repainted.

If context is not inbetween calls to drawContextBeginFrame and drawContextEndFrame, Nothing will be returned.

getSurface

drawContextGetSurface Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrawContext a) 
=> a

context: a DrawContext

-> m (Maybe Surface)

Returns: a Surface or Nothing

Retrieves the Surface used by the context.

isInFrame

drawContextIsInFrame Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrawContext a) 
=> a

context: a DrawContext

-> m Bool

Returns: True if the context is between drawContextBeginFrame and drawContextEndFrame calls.

Returns True if context is in the process of drawing to its surface after a call to drawContextBeginFrame and not yet having called drawContextEndFrame. In this situation, drawing commands may be effecting the contents of a context's surface.

Properties

display

The Display used to create the DrawContext.

getDrawContextDisplay :: (MonadIO m, IsDrawContext o) => o -> m (Maybe Display) Source #

Get the value of the “display” property. When overloading is enabled, this is equivalent to

get drawContext #display

surface

The Surface the gl context is bound to.

constructDrawContextSurface :: (IsDrawContext o, MonadIO m, IsSurface a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “surface” property. This is rarely needed directly, but it is used by new.

getDrawContextSurface :: (MonadIO m, IsDrawContext o) => o -> m (Maybe Surface) Source #

Get the value of the “surface” property. When overloading is enabled, this is equivalent to

get drawContext #surface