Class MemoryTextureBuilder
- All Implemented Interfaces:
Proxy
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.
- Since:
- 4.16
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classInner class implementing a builder pattern to construct a GObject with properties.static classNested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new MemoryTextureBuilder.MemoryTextureBuilder(MemorySegment address) Create a MemoryTextureBuilder proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected MemoryTextureBuilderasParent()Returns this instance as if it were its parent type.build()Builds a newGdkTexturewith the values set up in the builder.static MemoryTextureBuilder.Builder<? extends MemoryTextureBuilder.Builder> builder()AMemoryTextureBuilder.Builderobject constructs aMemoryTextureBuilderwith the specified properties.byte @Nullable []getBytes()Gets the bytes previously set via gdk_memory_texture_builder_set_bytes() ornullif 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().intGets the height previously set via gdk_memory_texture_builder_set_height() or 0 if the height wasn't set.longgetOffset(int plane) Gets the offset previously set via gdk_memory_texture_builder_set_offset().longGets the stride previously set via gdk_memory_texture_builder_set_stride().longgetStrideForPlane(int plane) Gets the stride previously set via gdk_memory_texture_builder_set_stride_for_plane().static @Nullable TypegetType()Get the GType of the MemoryTextureBuilder class@Nullable org.freedesktop.cairo.RegionGets the region previously set via gdk_memory_texture_builder_set_update_region() ornullif none was set.@Nullable TextureGets the texture previously set via gdk_memory_texture_builder_set_update_texture() ornullif none was set.intgetWidth()Gets the width previously set via gdk_memory_texture_builder_set_width() or 0 if the width wasn't set.voidsetBytes(byte @Nullable [] bytes) Sets the data to be shown but the texture.voidsetColorState(ColorState colorState) Sets the colorstate describing the data.voidsetFormat(MemoryFormat format) Sets the format of the bytes.voidsetHeight(int height) Sets the height of the texture.voidsetOffset(int plane, long offset) Sets the offset of the texture forplane.voidsetStride(long stride) Sets the rowstride of the bytes used.voidsetStrideForPlane(int plane, long stride) Sets the stride of the texture forplane.voidsetUpdateRegion(@Nullable org.freedesktop.cairo.Region region) Sets the region to be updated by this texture.voidsetUpdateTexture(@Nullable Texture texture) Sets the texture to be updated by this texture.voidsetWidth(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, 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
-
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 MemoryTextureBuilder.
-
-
Method Details
-
getType
Get the GType of the MemoryTextureBuilder class- Returns:
- the GType
-
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. -
build
Builds a newGdkTexturewith 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 - Since:
- 4.16
-
getBytes
public byte @Nullable [] getBytes()Gets the bytes previously set via gdk_memory_texture_builder_set_bytes() ornullif none was set.- Returns:
- The bytes
- Since:
- 4.16
-
getColorState
Gets the colorstate previously set via gdk_memory_texture_builder_set_color_state().- Returns:
- The colorstate
- Since:
- 4.16
-
getFormat
Gets the format previously set via gdk_memory_texture_builder_set_format().- Returns:
- The format
- Since:
- 4.16
-
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
- Since:
- 4.16
-
getOffset
public long getOffset(int plane) Gets the offset previously set via gdk_memory_texture_builder_set_offset().- Parameters:
plane- a plane- Returns:
- The offset associated to a
plane - Since:
- 4.20
-
getStride
public long getStride()Gets the stride previously set via gdk_memory_texture_builder_set_stride().- Returns:
- the stride
- Since:
- 4.16
-
getStrideForPlane
public long getStrideForPlane(int plane) Gets the stride previously set via gdk_memory_texture_builder_set_stride_for_plane().- Parameters:
plane- a plane- Returns:
- The stride associated to a
plane - Since:
- 4.20
-
getUpdateRegion
public @Nullable org.freedesktop.cairo.Region getUpdateRegion()Gets the region previously set via gdk_memory_texture_builder_set_update_region() ornullif none was set.- Returns:
- The update region
- Since:
- 4.16
-
getUpdateTexture
Gets the texture previously set via gdk_memory_texture_builder_set_update_texture() ornullif none was set.- Returns:
- The update texture
- Since:
- 4.16
-
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
- Since:
- 4.16
-
setBytes
public void setBytes(byte @Nullable [] bytes) Sets the data to be shown but the texture.The bytes must be set before calling
build().- Parameters:
bytes- The bytes the texture shows ornullto unset- Since:
- 4.16
-
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- Since:
- 4.16
-
setFormat
Sets the format of the bytes.The default is
GDK_MEMORY_R8G8B8A8_PREMULTIPLIED.- Parameters:
format- The texture's format- Since:
- 4.16
-
setHeight
public void setHeight(int height) Sets the height of the texture.The height must be set before calling
build()and conform to size requirements of the provided format.- Parameters:
height- The texture's height or 0 to unset- Since:
- 4.16
-
setOffset
public void setOffset(int plane, long offset) Sets the offset of the texture forplane.- Parameters:
plane- a planeoffset- the texture's offset forplane- Since:
- 4.20
-
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- Since:
- 4.16
-
setStrideForPlane
public void setStrideForPlane(int plane, long stride) Sets the stride of the texture forplane.- Parameters:
plane- a planestride- the texture's stride forplane- Since:
- 4.20
-
setUpdateRegion
public void setUpdateRegion(@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- Since:
- 4.16
-
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- Since:
- 4.16
-
setWidth
public void setWidth(int width) Sets the width of the texture.The width must be set before calling
build()and conform to size requirements of the provided format.- Parameters:
width- The texture's width or 0 to unset- Since:
- 4.16
-
builder
AMemoryTextureBuilder.Builderobject constructs aMemoryTextureBuilderwith the specified properties. Use the variousset...()methods to set properties, and finish construction withMemoryTextureBuilder.Builder.build().- Returns:
- the builder object
-