Class TextureDownloader

java.lang.Object
org.javagi.base.ProxyInstance
org.gnome.gdk.TextureDownloader
All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class TextureDownloader extends ProxyInstance

Used to download the contents of a Texture.

It is intended to be created as a short-term object for a single download, but can be used for multiple downloads of different textures or with different settings.

GdkTextureDownloader can be used to convert data between different formats. Create a GdkTexture for the existing format and then download it in a different format.

Since:
4.10
  • Constructor Details

    • TextureDownloader

      public TextureDownloader(MemorySegment address)
      Create a TextureDownloader proxy instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • TextureDownloader

      public TextureDownloader(Texture texture)

      Creates a new texture downloader for texture.

      By default, the downloader will convert the data to the default memory format, and to the sRGB color state.

      Parameters:
      texture - texture to download
      Since:
      4.10
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the TextureDownloader class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • copy

      public TextureDownloader copy()

      Creates a copy of the downloader.

      This function is meant for language bindings.

      Returns:
      A copy of the downloader
      Since:
      4.10
    • downloadBytes

      public byte[] downloadBytes(Out<Long> outStride)

      Downloads the given texture pixels into a GBytes. The rowstride will be stored in the stride value.

      This function will abort if it tries to download a large texture and fails to allocate memory. If you think that may happen, you should handle memory allocation yourself and use downloadInto(byte[], long) once allocation succeeded.

      This function cannot be used with a multiplanar format. Use downloadBytesWithPlanes(Out, Out) for that purpose.

      Parameters:
      outStride - The stride of the resulting data in bytes
      Returns:
      The downloaded pixels
      Since:
      4.10
    • downloadBytesWithPlanes

      public byte[] downloadBytesWithPlanes(@Nullable Out<long[]> outOffsets, @Nullable Out<long[]> outStrides)

      Downloads the given texture pixels into a GBytes. The offsets and strides of the resulting buffer will be stored in the respective values.

      If the format does have less than 4 planes, the remaining offsets and strides will be set to 0.

      Parameters:
      outOffsets - The offsets of the resulting data planes in bytes
      outStrides - The stride of the resulting data planes in bytes
      Returns:
      The downloaded pixels
      Since:
      4.20
    • downloadInto

      public void downloadInto(@Nullable byte @Nullable [] data, long stride)

      Downloads the texture into local memory.

      This function cannot be used with a multiplanar format.

      Parameters:
      data - pointer to enough memory to be filled with the downloaded data of the texture
      stride - rowstride in bytes
      Since:
      4.10
    • free

      public void free()
      Frees the given downloader and all its associated resources.
      Since:
      4.10
    • getColorState

      public ColorState getColorState()
      Gets the color state that the data will be downloaded in.
      Returns:
      The color state of the download
      Since:
      4.16
    • getFormat

      public MemoryFormat getFormat()
      Gets the format that the data will be downloaded in.
      Returns:
      The format of the download
      Since:
      4.10
    • getTexture

      public Texture getTexture()
      Gets the texture that the downloader will download.
      Returns:
      The texture to download
      Since:
      4.10
    • setColorState

      public void setColorState(ColorState colorState)

      Sets the color state the downloader will convert the data to.

      By default, the sRGB colorstate returned by ColorState.getSrgb() is used.

      Parameters:
      colorState - the color state to use
      Since:
      4.16
    • setFormat

      public void setFormat(MemoryFormat format)

      Sets the format the downloader will download.

      By default, GDK_MEMORY_DEFAULT is set.

      Parameters:
      format - the format to use
      Since:
      4.10
    • setTexture

      public void setTexture(Texture texture)
      Changes the texture the downloader will download.
      Parameters:
      texture - the new texture to download
      Since:
      4.10