Texture

open class Texture(pointer: <Error class: unknown class><<Error class: unknown class>>) : Paintable

GdkTexture is the basic element used to refer to pixel data.

It is primarily meant for pixel data that will not change over multiple frames, and will be used for a long time.

There are various ways to create GdkTexture objects from a class@GdkPixbuf.Pixbuf, or from bytes stored in memory, a file, or a struct@Gio.Resource.

The ownership of the pixel data is transferred to the GdkTexture instance; you can only make a copy of it, via method@Gdk.Texture.download.

GdkTexture is an immutable object: That means you cannot change anything about it other than increasing the reference count via method@GObject.Object.ref, and consequently, it is a threadsafe object.

GDK provides a number of threadsafe texture loading functions: ctor@Gdk.Texture.new_from_resource, ctor@Gdk.Texture.new_from_bytes, ctor@Gdk.Texture.new_from_file, ctor@Gdk.Texture.new_from_filename, ctor@Gdk.Texture.new_for_pixbuf. Note that these are meant for loading icons and resources that are shipped with the toolkit or application. It is recommended that you use a dedicated image loading framework such as glycin, if you need to load untrusted image data.

Skipped during bindings generation

  • parameter data: Array parameter of type guint8 is not supported

Inheritors

Constructors

Link copied to clipboard
constructor(pixbuf: <Error class: unknown class>)

Creates a new texture object representing the GdkPixbuf.

constructor(bytes: <Error class: unknown class>)

Creates a new texture by loading an image from memory,

constructor(file: <Error class: unknown class>)

Creates a new texture by loading an image from a file.

constructor(path: String)

Creates a new texture by loading an image from a file.

constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The color state of the texture.

Link copied to clipboard
open override val gdkPaintablePointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
val gdkTexturePointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open val gioIconPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open val gioLoadableIconPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open val height: <Error class: unknown class>

The height of the texture, in pixels.

Link copied to clipboard
open val width: <Error class: unknown class>

The width of the texture, in pixels.

Functions

Link copied to clipboard
open fun connectInvalidateContents(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

Emitted when the contents of the @paintable change.

Link copied to clipboard
open fun connectInvalidateSize(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

Emitted when the intrinsic size of the @paintable changes.

Link copied to clipboard

Gets an immutable paintable for the current contents displayed by @paintable.

Link copied to clipboard

Get flags for the paintable.

Link copied to clipboard

Gets the memory format most closely associated with the data of the texture.

Link copied to clipboard
open fun getIntrinsicAspectRatio(): <Error class: unknown class>

Gets the preferred aspect ratio the @paintable would like to be displayed at.

Link copied to clipboard
open fun getIntrinsicHeight(): <Error class: unknown class>

Gets the preferred height the @paintable would like to be displayed at.

Link copied to clipboard
open fun getIntrinsicWidth(): <Error class: unknown class>

Gets the preferred width the @paintable would like to be displayed at.

Link copied to clipboard

Called by implementations of GdkPaintable to invalidate their contents.

Link copied to clipboard
open fun invalidateSize()

Called by implementations of GdkPaintable to invalidate their size.

Link copied to clipboard
open fun saveToPng(filename: String): Boolean

Store the given @texture to the @filename as a PNG file.

Link copied to clipboard
open fun saveToPngBytes(): <Error class: unknown class>

Store the given @texture in memory as a PNG file.

Link copied to clipboard
open fun saveToTiff(filename: String): Boolean

Store the given @texture to the @filename as a TIFF file.

Link copied to clipboard
open fun saveToTiffBytes(): <Error class: unknown class>

Store the given @texture in memory as a TIFF file.

Link copied to clipboard
open fun snapshot(snapshot: Snapshot, width: <Error class: unknown class>, height: <Error class: unknown class>)

Snapshots the given paintable with the given @width and @height.