gi-gdk4-4.0.10: Gdk bindings

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

Contents

- Exported types
- Methods
  - copy
  - downloadBytes
  - downloadInto
  - free
  - getColorState
  - getFormat
  - getTexture
  - new
  - setColorState
  - setFormat
  - setTexture

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)
- 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

Instances details

Eq TextureDownloader Source # |
Instance details Defined in GI.Gdk.Structs.TextureDownloader Methods (==) :: TextureDownloader -> TextureDownloader -> Bool Source # (/=) :: TextureDownloader -> TextureDownloader -> Bool Source #
GBoxed TextureDownloader Source # |
Instance details Defined in GI.Gdk.Structs.TextureDownloader
ManagedPtrNewtype TextureDownloader Source # |
Instance details Defined in GI.Gdk.Structs.TextureDownloader Methods toManagedPtr :: TextureDownloader -> ManagedPtr TextureDownloader Source #
TypedObject TextureDownloader Source # |
Instance details Defined in GI.Gdk.Structs.TextureDownloader Methods glibType :: IO GType Source #
HasParentTypes TextureDownloader Source # |
Instance details Defined in GI.Gdk.Structs.TextureDownloader
IsGValue (Maybe TextureDownloader) Source # | Convert `TextureDownloader` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gdk.Structs.TextureDownloader Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe TextureDownloader -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe TextureDownloader) Source #
type ParentTypes TextureDownloader Source # |
Instance details Defined in GI.Gdk.Structs.TextureDownloader type ParentTypes TextureDownloader = '[] :: [Type]

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

copy, downloadBytes, downloadInto, free.

#### Getters

getColorState, getFormat, getTexture.

#### Setters

setColorState, setFormat, setTexture.

## copy

textureDownloaderCopy Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> TextureDownloader | `self`: the downloader to copy
-> 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 | `self`: the downloader
-> 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

## downloadInto

textureDownloaderDownloadInto Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> TextureDownloader | `self`: a texture downloader
-> Ptr Word8 | `data`: pointer to enough memory to be filled with the downloaded data of the texture
-> CSize | `stride`: rowstride in bytes
-> 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 | `self`: texture downloader to free
-> m () |

Frees the given downloader and all its associated resources.

Since: 4.10

## getColorState

textureDownloaderGetColorState Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> TextureDownloader | `self`: a texture downloader
-> 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 | `self`: a texture downloader
-> 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 | `self`: a texture downloader
-> m Texture | Returns: The texture to download

Gets the texture that the downloader will download.

Since: 4.10

## new

textureDownloaderNew Source #

Arguments

:: (HasCallStack, MonadIO m, IsTexture a) |
=> a | `texture`: texture to download
-> 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 | `self`: a texture downloader
-> ColorState | `colorState`: the color state to use
-> 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 | `self`: a texture downloader
-> MemoryFormat | `format`: the format to use
-> 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 | `self`: a texture downloader
-> a | `texture`: the new texture to download
-> m () |

Changes the texture the downloader will download.

Since: 4.10