Class MemoryTextureBuilder
- All Implemented Interfaces:
Proxy
GdkMemoryTextureBuilder
is a builder used to construct Texture
objects
from system memory provided via GLib.Bytes
.
The operation is quite simple: Create a texture builder, set all the necessary
properties - keep in mind that the properties Gdk.MemoryTextureBuilder:bytes
,
Gdk.MemoryTextureBuilder:stride
, Gdk.MemoryTextureBuilder:width
,
and Gdk.MemoryTextureBuilder:height
are mandatory - and then call
build()
to create the new texture.
GdkMemoryTextureBuilder
can be used for quick one-shot construction of
textures as well as kept around and reused to construct multiple textures.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Inner class implementing a builder pattern to construct a GObject with properties.static class
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionCreates a new texture builder.MemoryTextureBuilder
(MemorySegment address) Create a MemoryTextureBuilder proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected MemoryTextureBuilder
asParent()
Returns this instance as if it were its parent type.build()
Builds a newGdkTexture
with the values set up in the builder.static MemoryTextureBuilder.Builder
<? extends MemoryTextureBuilder.Builder> builder()
AMemoryTextureBuilder.Builder
object constructs aMemoryTextureBuilder
with the specified properties.getBytes()
Gets the bytes previously set via gdk_memory_texture_builder_set_bytes() ornull
if none was set.Gets the colorstate previously set via gdk_memory_texture_builder_set_color_state().Gets the format previously set via gdk_memory_texture_builder_set_format().int
Gets the height previously set via gdk_memory_texture_builder_set_height() or 0 if the height wasn't set.long
Gets the stride previously set via gdk_memory_texture_builder_set_stride().static Type
getType()
Get the GType of the MemoryTextureBuilder classorg.freedesktop.cairo.Region
Gets the region previously set via gdk_memory_texture_builder_set_update_region() ornull
if none was set.Gets the texture previously set via gdk_memory_texture_builder_set_update_texture() ornull
if none was set.int
getWidth()
Gets the width previously set via gdk_memory_texture_builder_set_width() or 0 if the width wasn't set.void
Sets the data to be shown but the texture.void
setColorState
(@Nullable ColorState colorState) Sets the colorstate describing the data.void
setFormat
(MemoryFormat format) Sets the format of the bytes.void
setHeight
(int height) Sets the height of the texture.void
setStride
(long stride) Sets the rowstride of the bytes used.void
setUpdateRegion
(@Nullable org.freedesktop.cairo.Region region) Sets the region to be updated by this texture.void
setUpdateTexture
(@Nullable Texture texture) Sets the texture to be updated by this texture.void
setWidth
(int width) Sets the width of the texture.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
-
MemoryTextureBuilder
Create a MemoryTextureBuilder proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
MemoryTextureBuilder
public MemoryTextureBuilder()Creates a new texture builder.
-
-
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. -
build
Builds a newGdkTexture
with the values set up in the builder.Note that it is a programming error to call this function if any mandatory property has not been set.
It is possible to call this function multiple times to create multiple textures, possibly with changing properties in between.
- Returns:
- a newly built
GdkTexture
-
getBytes
Gets the bytes previously set via gdk_memory_texture_builder_set_bytes() ornull
if none was set.- Returns:
- The bytes
-
getColorState
Gets the colorstate previously set via gdk_memory_texture_builder_set_color_state().- Returns:
- The colorstate
-
getFormat
Gets the format previously set via gdk_memory_texture_builder_set_format().- Returns:
- The format
-
getHeight
public int getHeight()Gets the height previously set via gdk_memory_texture_builder_set_height() or 0 if the height wasn't set.- Returns:
- The height
-
getStride
public long getStride()Gets the stride previously set via gdk_memory_texture_builder_set_stride().- Returns:
- the stride
-
getUpdateRegion
public org.freedesktop.cairo.Region getUpdateRegion()Gets the region previously set via gdk_memory_texture_builder_set_update_region() ornull
if none was set.- Returns:
- The update region
-
getUpdateTexture
Gets the texture previously set via gdk_memory_texture_builder_set_update_texture() ornull
if none was set.- Returns:
- The update texture
-
getWidth
public int getWidth()Gets the width previously set via gdk_memory_texture_builder_set_width() or 0 if the width wasn't set.- Returns:
- The width
-
setBytes
-
setColorState
Sets the colorstate describing the data.By default, the sRGB colorstate is used. If you don't know what colorstates are, this is probably the right thing.
- Parameters:
colorState
- The colorstate describing the data
-
setFormat
Sets the format of the bytes.The default is
GDK_MEMORY_R8G8B8A8_PREMULTIPLIED
.- Parameters:
format
- The texture's format
-
setHeight
public void setHeight(int height) Sets the height of the texture.The height must be set before calling
build()
.- Parameters:
height
- The texture's height or 0 to unset
-
setStride
public void setStride(long stride) Sets the rowstride of the bytes used.The rowstride must be set before calling
build()
.- Parameters:
stride
- the stride or 0 to unset
-
setUpdateRegion
public void setUpdateRegion(@Nullable @Nullable org.freedesktop.cairo.Region region) Sets the region to be updated by this texture.Together with
Gdk.MemoryTextureBuilder:update-texture
, this describes an update of a previous texture.When rendering animations of large textures, it is possible that consecutive textures are only updating contents in parts of the texture. It is then possible to describe this update via these two properties, so that GTK can avoid rerendering parts that did not change.
An example would be a screen recording where only the mouse pointer moves.
- Parameters:
region
- the region to update
-
setUpdateTexture
Sets the texture to be updated by this texture.See
setUpdateRegion(org.freedesktop.cairo.Region)
for an explanation.- Parameters:
texture
- the texture to update
-
setWidth
public void setWidth(int width) Sets the width of the texture.The width must be set before calling
build()
.- Parameters:
width
- The texture's width or 0 to unset
-
builder
AMemoryTextureBuilder.Builder
object constructs aMemoryTextureBuilder
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withMemoryTextureBuilder.Builder.build()
.
-