Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
GI.Gdk.Structs.TextureDownloader
Description
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
Synopsis
- newtype TextureDownloader = TextureDownloader (ManagedPtr TextureDownloader)
- textureDownloaderCopy :: (HasCallStack, MonadIO m) => TextureDownloader -> m TextureDownloader
- textureDownloaderDownloadBytes :: (HasCallStack, MonadIO m) => TextureDownloader -> m (Bytes, CSize)
- textureDownloaderDownloadBytesWithPlanes :: (HasCallStack, MonadIO m) => TextureDownloader -> m (Bytes, [CSize], [CSize])
- textureDownloaderDownloadInto :: (HasCallStack, MonadIO m) => TextureDownloader -> Ptr Word8 -> CSize -> m ()
- textureDownloaderFree :: (HasCallStack, MonadIO m) => TextureDownloader -> m ()
- textureDownloaderGetColorState :: (HasCallStack, MonadIO m) => TextureDownloader -> m ColorState
- textureDownloaderGetFormat :: (HasCallStack, MonadIO m) => TextureDownloader -> m MemoryFormat
- textureDownloaderGetTexture :: (HasCallStack, MonadIO m) => TextureDownloader -> m Texture
- textureDownloaderNew :: (HasCallStack, MonadIO m, IsTexture a) => a -> m TextureDownloader
- textureDownloaderSetColorState :: (HasCallStack, MonadIO m) => TextureDownloader -> ColorState -> m ()
- textureDownloaderSetFormat :: (HasCallStack, MonadIO m) => TextureDownloader -> MemoryFormat -> m ()
- textureDownloaderSetTexture :: (HasCallStack, MonadIO m, IsTexture a) => TextureDownloader -> a -> m ()
Exported types
newtype TextureDownloader Source #
Memory-managed wrapper type.
Constructors
TextureDownloader (ManagedPtr TextureDownloader) |
Instances
Methods
Click to display all available methods, including inherited ones
Methods
copy, downloadBytes, downloadBytesWithPlanes, downloadInto, free.
Getters
getColorState, getFormat, getTexture.
Setters
copy
textureDownloaderCopy Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> TextureDownloader |
|
-> m TextureDownloader | Returns: A copy of the downloader |
Creates a copy of the downloader.
This function is meant for language bindings.
Since: 4.10
downloadBytes
textureDownloaderDownloadBytes Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> TextureDownloader |
|
-> m (Bytes, CSize) | Returns: The downloaded pixels |
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 textureDownloaderDownloadInto
once allocation succeeded.
This function cannot be used with a multiplanar format. Use
textureDownloaderDownloadBytesWithPlanes
for that purpose.
Since: 4.10
downloadBytesWithPlanes
textureDownloaderDownloadBytesWithPlanes Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> TextureDownloader |
|
-> m (Bytes, [CSize], [CSize]) | Returns: The downloaded pixels |
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
.
Since: 4.20
downloadInto
textureDownloaderDownloadInto Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> TextureDownloader |
|
-> Ptr Word8 |
|
-> CSize |
|
-> m () |
Downloads the texture
into local memory.
This function cannot be used with a multiplanar format.
Since: 4.10
free
textureDownloaderFree Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> TextureDownloader |
|
-> m () |
Frees the given downloader and all its associated resources.
Since: 4.10
getColorState
textureDownloaderGetColorState Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> TextureDownloader |
|
-> m ColorState | Returns: The color state of the download |
Gets the color state that the data will be downloaded in.
Since: 4.16
getFormat
textureDownloaderGetFormat Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> TextureDownloader |
|
-> m MemoryFormat | Returns: The format of the download |
Gets the format that the data will be downloaded in.
Since: 4.10
getTexture
textureDownloaderGetTexture Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> TextureDownloader |
|
-> m Texture | Returns: The texture to download |
Gets the texture that the downloader will download.
Since: 4.10
new
Arguments
:: (HasCallStack, MonadIO m, IsTexture a) | |
=> a |
|
-> m TextureDownloader | Returns: A new texture downloader |
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.
Since: 4.10
setColorState
textureDownloaderSetColorState Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> TextureDownloader |
|
-> ColorState |
|
-> m () |
Sets the color state the downloader will convert the data to.
By default, the sRGB colorstate returned by ColorState.get_srgb
is used.
Since: 4.16
setFormat
textureDownloaderSetFormat Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> TextureDownloader |
|
-> MemoryFormat |
|
-> m () |
Sets the format the downloader will download.
By default, GDK_MEMORY_DEFAULT is set.
Since: 4.10
setTexture
textureDownloaderSetTexture Source #
Arguments
:: (HasCallStack, MonadIO m, IsTexture a) | |
=> TextureDownloader |
|
-> a |
|
-> m () |
Changes the texture the downloader will download.
Since: 4.10