Class DrawContext
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
CairoContext,DrawContext.DrawContext$Impl,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
Nested ClassesModifier and TypeClassDescriptionstatic classDrawContext.Builder<B extends DrawContext.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classThe DrawContext$Impl 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
ConstructorsConstructorDescriptionCreates a new DrawContext.DrawContext(MemorySegment address) Create a DrawContext proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected DrawContextasParent()Returns this instance as if it were its parent type.voidbeginFrame(org.freedesktop.cairo.Region region) Deprecated.Drawing directly to the surface is no longer recommended.voidendFrame()Deprecated.Drawing directly to the surface is no longer recommended.@Nullable DisplayRetrieves theGdkDisplaythe this DrawContext is created for@Nullable org.freedesktop.cairo.RegionDeprecated.Drawing directly to the surface is no longer recommended.@Nullable SurfaceRetrieves the surface that this DrawContext is bound to.static @Nullable TypegetType()Get the GType of the DrawContext classbooleanDeprecated.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, builder, 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, 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, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.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
-
DrawContext
public DrawContext()Creates a new DrawContext.
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, 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. UseGskRenderNodeandGskRenderer.Indicates that you are beginning the process of redrawingregionon thecontext'ssurface.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
CairoContextand aGLContextneed 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
regionpassed 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. UseGskRenderNodeandGskRenderer.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 theGdkDisplaythe this DrawContext is created for- Returns:
- the
GdkDisplay
-
getFrameRegion
Deprecated.Drawing directly to the surface is no longer recommended. UseGskRenderNodeandGskRenderer.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(),nullwill 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. UseGskRenderNodeandGskRenderer.Returnstrueif 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 thecontext'ssurface.- Returns:
trueif the context is betweenbeginFrame(org.freedesktop.cairo.Region)andendFrame()calls.
-