### Class

# Gdk Texture

since: 4.0

#### Description [src]

    abstract class Gdk.Texture : GObject.Object
      implements Gdk.Paintable, Gio.Icon, Gio.LoadableIcon {
      /* No available fields */
    }

`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 `GdkPixbuf`, or from bytes stored in memory, a file, or a `GResource`.

The ownership of the pixel data is transferred to the `GdkTexture` instance; you can only make a copy of it, via `gdk_texture_download()`.

`GdkTexture` is an immutable object: That means you cannot change anything about it other than increasing the reference count via `g_object_ref()`, and consequently, it is a thread-safe object.

Available since: 4.0

#### Ancestors

- GObject

#### Descendants

- GdkDmabufTexture
- GdkGLTexture
- GdkMemoryTexture

#### Implements

- GdkPaintable
- GIcon
- GLoadableIcon

#### Constructors

###### gdk_texture_new_for_pixbuf

Creates a new texture object representing the `GdkPixbuf`.

since: 4.0

###### gdk_texture_new_from_bytes

Creates a new texture by loading an image from memory,

since: 4.6

###### gdk_texture_new_from_file

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

since: 4.0

###### gdk_texture_new_from_filename

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

since: 4.6

###### gdk_texture_new_from_resource

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

since: 4.0

#### Instance methods

###### gdk_texture_download

Downloads the `texture` into local memory.

since: 4.0

###### gdk_texture_get_format

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

since: 4.10

###### gdk_texture_get_height

Returns the height of the `texture`, in pixels.

since: 4.0

###### gdk_texture_get_width

Returns the width of `texture`, in pixels.

since: 4.0

###### gdk_texture_save_to_png

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

since: 4.0

###### gdk_texture_save_to_png_bytes

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

since: 4.6

###### gdk_texture_save_to_tiff

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

since: 4.6

###### gdk_texture_save_to_tiff_bytes

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

since: 4.6

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

##### Methods inherited from GdkPaintable (9)

###### gdk_paintable_compute_concrete_size

Compute a concrete size for the `GdkPaintable`.

since: 4.0

###### gdk_paintable_get_current_image

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

since: 4.0

###### gdk_paintable_get_flags

Get flags for the paintable.

since: 4.0

###### gdk_paintable_get_intrinsic_aspect_ratio

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

since: 4.0

###### gdk_paintable_get_intrinsic_height

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

since: 4.0

###### gdk_paintable_get_intrinsic_width

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

since: 4.0

###### gdk_paintable_invalidate_contents

Called by implementations of `GdkPaintable` to invalidate their contents.

since: 4.0

###### gdk_paintable_invalidate_size

Called by implementations of `GdkPaintable` to invalidate their size.

since: 4.0

###### gdk_paintable_snapshot

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

since: 4.0

##### Methods inherited from GIcon (4)

###### g_icon_equal

Checks if two icons are equal.

since: 2.0

###### g_icon_hash

Gets a hash for an icon.

since: 2.0

###### g_icon_serialize

Serializes a `GIcon` into a `GVariant`. An equivalent `GIcon` can be retrieved back by calling `g_icon_deserialize()` on the returned value. As serialization will avoid using raw icon data when possible, it only makes sense to transfer the `GVariant` between processes on the same machine, (as opposed to over the network), and within the same file system namespace.

since: 2.38

###### g_icon_to_string

Generates a textual representation of `icon` that can be used for serialization such as when passing `icon` to a different process or saving it to persistent storage. Use `g_icon_new_for_string()` to get `icon` back from the returned string.

since: 2.20

##### Methods inherited from GLoadableIcon (3)

###### g_loadable_icon_load

Loads a loadable icon. For the asynchronous version of this function, see g_loadable_icon_load_async().

since: 2.0

###### g_loadable_icon_load_async

Loads an icon asynchronously. To finish this function, see g_loadable_icon_load_finish(). For the synchronous, blocking version of this function, see g_loadable_icon_load().

since: 2.0

###### g_loadable_icon_load_finish

Finishes an asynchronous icon load started in g_loadable_icon_load_async().

since: 2.0

#### Properties

###### Gdk.Texture:height

The height of the texture, in pixels.

since: 4.0

###### Gdk.Texture:width

The width of the texture, in pixels.

since: 4.0

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

since: 2.0

##### Signals inherited from GdkPaintable (2)

###### GdkPaintable::invalidate-contents

Emitted when the contents of the `paintable` change.

since: 4.0

###### GdkPaintable::invalidate-size

Emitted when the intrinsic size of the `paintable` changes.

since: 4.0

#### Class structure

    struct GdkTextureClass {
      /* no available fields */
    }

No description available.