Class DrawContext
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
CairoContext
,DrawContext.DrawContextImpl
,GLContext
,VulkanContext
GdkDrawContext
is the base object used by contexts implementing different
rendering methods, such as CairoContext
or GLContext
.
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
DrawContext.Builder<B extends DrawContext.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static class
The DrawContextImpl type represents a native instance of the abstract DrawContext class.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionDrawContext
(MemorySegment address) Create a DrawContext proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected DrawContext
asParent()
Returns this instance as if it were its parent type.void
beginFrame
(org.freedesktop.cairo.Region region) Deprecated.Drawing directly to the surface is no longer recommended.static DrawContext.Builder
<? extends DrawContext.Builder> builder()
ADrawContext.Builder
object constructs aDrawContext
with the specified properties.void
endFrame()
Deprecated.Drawing directly to the surface is no longer recommended.Retrieves theGdkDisplay
the this DrawContext is created fororg.freedesktop.cairo.Region
Deprecated.Drawing directly to the surface is no longer recommended.Retrieves the surface that this DrawContext is bound to.static Type
getType()
Get the GType of the DrawContext classboolean
Deprecated.Drawing directly to the surface is no longer recommended.Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getMemoryLayout, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newInstance, newInstance, newv, notify_, notify_, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
DrawContext
Create a DrawContext proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()
doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName()
. This will call the native function pointer of this virtual method in the typeclass of the parent type. -
beginFrame
Deprecated.Drawing directly to the surface is no longer recommended. UseGskRenderNode
andGskRenderer
.Indicates that you are beginning the process of redrawingregion
on the this DrawContext's surface.Calling this function begins a drawing operation using this DrawContext on the surface that this DrawContext was created from. The actual requirements and guarantees for the drawing operation vary for different implementations of drawing, so a
CairoContext
and aGLContext
need to be treated differently.A call to this function is a requirement for drawing and must be followed by a call to
endFrame()
, 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 usegetFrameRegion()
to query the region that must be drawn.When using GTK, the widget system automatically places calls to gdk_draw_context_begin_frame() and gdk_draw_context_end_frame() via the use of GskRenderers, so application code does not need to call these functions explicitly.
- Parameters:
region
- minimum region that should be drawn
-
endFrame
Deprecated.Drawing directly to the surface is no longer recommended. UseGskRenderNode
andGskRenderer
.Ends a drawing operation started with gdk_draw_context_begin_frame().This makes the drawing available on screen. See
beginFrame(org.freedesktop.cairo.Region)
for more details about drawing.When using a
GLContext
, this function may callglFlush()
implicitly before returning; it is not recommended to callglFlush()
explicitly before calling this function. -
getDisplay
Retrieves theGdkDisplay
the this DrawContext is created for- Returns:
- the
GdkDisplay
-
getFrameRegion
Deprecated.Drawing directly to the surface is no longer recommended. UseGskRenderNode
andGskRenderer
.Retrieves the region that is currently being repainted.After a call to
beginFrame(org.freedesktop.cairo.Region)
this function will return a union of the region passed to that function and the area of the surface that the this DrawContext determined needs to be repainted.If this DrawContext is not in between calls to
beginFrame(org.freedesktop.cairo.Region)
andendFrame()
,null
will be returned.- Returns:
- a Cairo region
-
getSurface
Retrieves the surface that this DrawContext is bound to.- Returns:
- a
GdkSurface
-
isInFrame
Deprecated.Drawing directly to the surface is no longer recommended. UseGskRenderNode
andGskRenderer
.Returnstrue
if this DrawContext is in the process of drawing to its surface.This is the case between calls to
beginFrame(org.freedesktop.cairo.Region)
andendFrame()
. In this situation, drawing commands may be effecting the contents of the this DrawContext's surface.- Returns:
true
if the context is betweenbeginFrame(org.freedesktop.cairo.Region)
andendFrame()
calls.
-
builder
ADrawContext.Builder
object constructs aDrawContext
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withDrawContext.Builder.build()
.
-