gi-gdk-4.0.9: Gdk bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Gdk.Objects.GLTextureBuilder

Description

GdkGLTextureBuilder is a builder used to construct Texture objects from GL textures.

The operation is quite simple: Create a texture builder, set all the necessary properties - keep in mind that the properties GLTextureBuilder:context, GLTextureBuilder:id, GLTextureBuilder:width, and GLTextureBuilder:height are mandatory - and then call gLTextureBuilderBuild to create the new texture.

GdkGLTextureBuilder can be used for quick one-shot construction of textures as well as kept around and reused to construct multiple textures.

Since: 4.12

Synopsis

Exported types

class (GObject o, IsDescendantOf GLTextureBuilder o) => IsGLTextureBuilder o Source #

Type class for types which can be safely cast to GLTextureBuilder, for instance with toGLTextureBuilder.

Instances

Instances details
(GObject o, IsDescendantOf GLTextureBuilder o) => IsGLTextureBuilder o Source # 
Instance details

Defined in GI.Gdk.Objects.GLTextureBuilder

toGLTextureBuilder :: (MonadIO m, IsGLTextureBuilder o) => o -> m GLTextureBuilder Source #

Cast to GLTextureBuilder, for types for which this is known to be safe. For general casts, use castTo.

Methods

build

gLTextureBuilderBuild Source #

Arguments

:: (HasCallStack, MonadIO m, IsGLTextureBuilder a) 
=> a

self: a GdkGLTextureBuilder

-> Maybe DestroyNotify

destroy: destroy function to be called when the texture is released

-> Ptr ()

data: user data to pass to the destroy function

-> m Texture

Returns: a newly built GdkTexture

Builds a new GdkTexture with the values set up in the builder.

The destroy function gets called when the returned texture gets released; either when the texture is finalized or by an explicit call to gLTextureRelease. It should release all GL resources associated with the texture, such as the GLTextureBuilder:id and the GLTextureBuilder:sync.

Note that it is a programming error to call this function if any mandatory property has not been set.

It is possible to call this function multiple times to create multiple textures, possibly with changing properties in between.

Since: 4.12

getContext

gLTextureBuilderGetContext Source #

Arguments

:: (HasCallStack, MonadIO m, IsGLTextureBuilder a) 
=> a

self: a GdkGLTextureBuilder

-> m (Maybe GLContext)

Returns: The context

Gets the context previously set via gLTextureBuilderSetContext or Nothing if none was set.

Since: 4.12

getFormat

gLTextureBuilderGetFormat Source #

Arguments

:: (HasCallStack, MonadIO m, IsGLTextureBuilder a) 
=> a

self: a GdkGLTextureBuilder

-> m MemoryFormat

Returns: The format

Gets the format previously set via gLTextureBuilderSetFormat.

Since: 4.12

getHasMipmap

gLTextureBuilderGetHasMipmap Source #

Arguments

:: (HasCallStack, MonadIO m, IsGLTextureBuilder a) 
=> a

self: a GdkGLTextureBuilder

-> m Bool

Returns: Whether the texture has a mipmap

Gets whether the texture has a mipmap.

Since: 4.12

getHeight

gLTextureBuilderGetHeight Source #

Arguments

:: (HasCallStack, MonadIO m, IsGLTextureBuilder a) 
=> a

self: a GdkGLTextureBuilder

-> m Int32

Returns: The height

Gets the height previously set via gLTextureBuilderSetHeight or 0 if the height wasn't set.

Since: 4.12

getId

gLTextureBuilderGetId Source #

Arguments

:: (HasCallStack, MonadIO m, IsGLTextureBuilder a) 
=> a

self: a GdkGLTextureBuilder

-> m Word32

Returns: The id

Gets the texture id previously set via gLTextureBuilderSetId or 0 if the id wasn't set.

Since: 4.12

getSync

gLTextureBuilderGetSync Source #

Arguments

:: (HasCallStack, MonadIO m, IsGLTextureBuilder a) 
=> a

self: a GdkGLTextureBuilder

-> m (Ptr ())

Returns: the GLSync

Gets the GLsync previously set via gLTextureBuilderSetSync.

Since: 4.12

getUpdateRegion

gLTextureBuilderGetUpdateRegion Source #

Arguments

:: (HasCallStack, MonadIO m, IsGLTextureBuilder a) 
=> a

self: a GdkGLTextureBuilder

-> m (Maybe Region)

Returns: The region

Gets the region previously set via gLTextureBuilderSetUpdateRegion or Nothing if none was set.

Since: 4.12

getUpdateTexture

gLTextureBuilderGetUpdateTexture Source #

Arguments

:: (HasCallStack, MonadIO m, IsGLTextureBuilder a) 
=> a

self: a GdkGLTextureBuilder

-> m (Maybe Texture)

Returns: The texture

Gets the texture previously set via gLTextureBuilderSetUpdateTexture or Nothing if none was set.

Since: 4.12

getWidth

gLTextureBuilderGetWidth Source #

Arguments

:: (HasCallStack, MonadIO m, IsGLTextureBuilder a) 
=> a

self: a GdkGLTextureBuilder

-> m Int32

Returns: The width

Gets the width previously set via gLTextureBuilderSetWidth or 0 if the width wasn't set.

Since: 4.12

new

gLTextureBuilderNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m GLTextureBuilder

Returns: the new GdkTextureBuilder

Creates a new texture builder.

Since: 4.12

setContext

gLTextureBuilderSetContext Source #

Arguments

:: (HasCallStack, MonadIO m, IsGLTextureBuilder a, IsGLContext b) 
=> a

self: a GdkGLTextureBuilder

-> Maybe b

context: The context the texture beongs to or Nothing to unset

-> m () 

Sets the context to be used for the texture. This is the context that owns the texture.

The context must be set before calling gLTextureBuilderBuild.

Since: 4.12

setFormat

gLTextureBuilderSetFormat Source #

Arguments

:: (HasCallStack, MonadIO m, IsGLTextureBuilder a) 
=> a

self: a GdkGLTextureBuilder

-> MemoryFormat

format: The texture's format

-> m () 

Sets the format of the texture. The default is GDK_MEMORY_R8G8B8A8_PREMULTIPLIED.

The format is the preferred format the texture data should be downloaded to. The format must be supported by the GL version of GLTextureBuilder:context.

GDK's texture download code assumes that the format corresponds to the storage parameters of the GL texture in an obvious way. For example, a format of GDK_MEMORY_R16G16B16A16_PREMULTIPLIED is expected to be stored as GL_RGBA16 texture, and GDK_MEMORY_G8A8 is expected to be stored as GL_RG8 texture.

Setting the right format is particularly useful when using high bit depth textures to preserve the bit depth, to set the correct value for unpremultiplied textures and to make sure opaque textures are treated as such.

Non-RGBA textures need to have swizzling parameters set up properly to be usable in GSK's shaders.

Since: 4.12

setHasMipmap

gLTextureBuilderSetHasMipmap Source #

Arguments

:: (HasCallStack, MonadIO m, IsGLTextureBuilder a) 
=> a

self: a GdkGLTextureBuilder

-> Bool

hasMipmap: Whether the texture has a mipmap

-> m () 

Sets whether the texture has a mipmap. This allows the renderer and other users of the generated texture to use a higher quality downscaling.

Typically, the glGenerateMipmap function is used to generate a mimap.

Since: 4.12

setHeight

gLTextureBuilderSetHeight Source #

Arguments

:: (HasCallStack, MonadIO m, IsGLTextureBuilder a) 
=> a

self: a GdkGLTextureBuilder

-> Int32

height: The texture's height or 0 to unset

-> m () 

Sets the height of the texture.

The height must be set before calling gLTextureBuilderBuild.

Since: 4.12

setId

gLTextureBuilderSetId Source #

Arguments

:: (HasCallStack, MonadIO m, IsGLTextureBuilder a) 
=> a

self: a GdkGLTextureBuilder

-> Word32

id: The texture id to be used for creating the texture

-> m () 

Sets the texture id of the texture. The texture id must remain unmodified until the texture was finalized. See gLTextureBuilderBuild for a longer discussion.

The id must be set before calling gLTextureBuilderBuild.

Since: 4.12

setSync

gLTextureBuilderSetSync Source #

Arguments

:: (HasCallStack, MonadIO m, IsGLTextureBuilder a) 
=> a

self: a GdkGLTextureBuilder

-> Ptr ()

sync: the GLSync object

-> m () 

Sets the GLSync object to use for the texture.

GTK will wait on this object before using the created GdkTexture.

The destroy function that is passed to gLTextureBuilderBuild is responsible for freeing the sync object when it is no longer needed. The texture builder does not destroy it and it is the callers responsibility to make sure it doesn't leak.

Since: 4.12

setUpdateRegion

gLTextureBuilderSetUpdateRegion Source #

Arguments

:: (HasCallStack, MonadIO m, IsGLTextureBuilder a) 
=> a

self: a GdkGLTextureBuilder

-> Maybe Region

region: the region to update

-> m () 

Sets the region to be updated by this texture. Together with GLTextureBuilder:updateTexture this describes an update of a previous texture.

When rendering animations of large textures, it is possible that consecutive textures are only updating contents in parts of the texture. It is then possible to describe this update via these two properties, so that GTK can avoid rerendering parts that did not change.

An example would be a screen recording where only the mouse pointer moves.

Since: 4.12

setUpdateTexture

gLTextureBuilderSetUpdateTexture Source #

Arguments

:: (HasCallStack, MonadIO m, IsGLTextureBuilder a, IsTexture b) 
=> a

self: a GdkGLTextureBuilder

-> Maybe b

texture: the texture to update

-> m () 

Sets the texture to be updated by this texture. See gLTextureBuilderSetUpdateRegion for an explanation.

Since: 4.12

setWidth

gLTextureBuilderSetWidth Source #

Arguments

:: (HasCallStack, MonadIO m, IsGLTextureBuilder a) 
=> a

self: a GdkGLTextureBuilder

-> Int32

width: The texture's width or 0 to unset

-> m () 

Sets the width of the texture.

The width must be set before calling gLTextureBuilderBuild.

Since: 4.12

Properties

context

The context owning the texture.

Since: 4.12

clearGLTextureBuilderContext :: (MonadIO m, IsGLTextureBuilder o) => o -> m () Source #

Set the value of the “context” property to Nothing. When overloading is enabled, this is equivalent to

clear #context

constructGLTextureBuilderContext :: (IsGLTextureBuilder o, MonadIO m, IsGLContext a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “context” property. This is rarely needed directly, but it is used by new.

getGLTextureBuilderContext :: (MonadIO m, IsGLTextureBuilder o) => o -> m (Maybe GLContext) Source #

Get the value of the “context” property. When overloading is enabled, this is equivalent to

get gLTextureBuilder #context

setGLTextureBuilderContext :: (MonadIO m, IsGLTextureBuilder o, IsGLContext a) => o -> a -> m () Source #

Set the value of the “context” property. When overloading is enabled, this is equivalent to

set gLTextureBuilder [ #context := value ]

format

The format when downloading the texture.

Since: 4.12

constructGLTextureBuilderFormat :: (IsGLTextureBuilder o, MonadIO m) => MemoryFormat -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “format” property. This is rarely needed directly, but it is used by new.

getGLTextureBuilderFormat :: (MonadIO m, IsGLTextureBuilder o) => o -> m MemoryFormat Source #

Get the value of the “format” property. When overloading is enabled, this is equivalent to

get gLTextureBuilder #format

setGLTextureBuilderFormat :: (MonadIO m, IsGLTextureBuilder o) => o -> MemoryFormat -> m () Source #

Set the value of the “format” property. When overloading is enabled, this is equivalent to

set gLTextureBuilder [ #format := value ]

hasMipmap

If the texture has a mipmap.

Since: 4.12

constructGLTextureBuilderHasMipmap :: (IsGLTextureBuilder o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “has-mipmap” property. This is rarely needed directly, but it is used by new.

getGLTextureBuilderHasMipmap :: (MonadIO m, IsGLTextureBuilder o) => o -> m Bool Source #

Get the value of the “has-mipmap” property. When overloading is enabled, this is equivalent to

get gLTextureBuilder #hasMipmap

setGLTextureBuilderHasMipmap :: (MonadIO m, IsGLTextureBuilder o) => o -> Bool -> m () Source #

Set the value of the “has-mipmap” property. When overloading is enabled, this is equivalent to

set gLTextureBuilder [ #hasMipmap := value ]

height

The height of the texture.

Since: 4.12

constructGLTextureBuilderHeight :: (IsGLTextureBuilder o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “height” property. This is rarely needed directly, but it is used by new.

getGLTextureBuilderHeight :: (MonadIO m, IsGLTextureBuilder o) => o -> m Int32 Source #

Get the value of the “height” property. When overloading is enabled, this is equivalent to

get gLTextureBuilder #height

setGLTextureBuilderHeight :: (MonadIO m, IsGLTextureBuilder o) => o -> Int32 -> m () Source #

Set the value of the “height” property. When overloading is enabled, this is equivalent to

set gLTextureBuilder [ #height := value ]

id

The texture ID to use.

Since: 4.12

constructGLTextureBuilderId :: (IsGLTextureBuilder o, MonadIO m) => Word32 -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “id” property. This is rarely needed directly, but it is used by new.

getGLTextureBuilderId :: (MonadIO m, IsGLTextureBuilder o) => o -> m Word32 Source #

Get the value of the “id” property. When overloading is enabled, this is equivalent to

get gLTextureBuilder #id

setGLTextureBuilderId :: (MonadIO m, IsGLTextureBuilder o) => o -> Word32 -> m () Source #

Set the value of the “id” property. When overloading is enabled, this is equivalent to

set gLTextureBuilder [ #id := value ]

sync

An optional GLSync object.

If this is set, GTK will wait on it before using the texture.

Since: 4.12

constructGLTextureBuilderSync :: (IsGLTextureBuilder o, MonadIO m) => Ptr () -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “sync” property. This is rarely needed directly, but it is used by new.

getGLTextureBuilderSync :: (MonadIO m, IsGLTextureBuilder o) => o -> m (Ptr ()) Source #

Get the value of the “sync” property. When overloading is enabled, this is equivalent to

get gLTextureBuilder #sync

setGLTextureBuilderSync :: (MonadIO m, IsGLTextureBuilder o) => o -> Ptr () -> m () Source #

Set the value of the “sync” property. When overloading is enabled, this is equivalent to

set gLTextureBuilder [ #sync := value ]

updateRegion

The update region for GLTextureBuilder:updateTexture.

Since: 4.12

clearGLTextureBuilderUpdateRegion :: (MonadIO m, IsGLTextureBuilder o) => o -> m () Source #

Set the value of the “update-region” property to Nothing. When overloading is enabled, this is equivalent to

clear #updateRegion

constructGLTextureBuilderUpdateRegion :: (IsGLTextureBuilder o, MonadIO m) => Region -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “update-region” property. This is rarely needed directly, but it is used by new.

getGLTextureBuilderUpdateRegion :: (MonadIO m, IsGLTextureBuilder o) => o -> m (Maybe Region) Source #

Get the value of the “update-region” property. When overloading is enabled, this is equivalent to

get gLTextureBuilder #updateRegion

setGLTextureBuilderUpdateRegion :: (MonadIO m, IsGLTextureBuilder o) => o -> Region -> m () Source #

Set the value of the “update-region” property. When overloading is enabled, this is equivalent to

set gLTextureBuilder [ #updateRegion := value ]

updateTexture

The texture GLTextureBuilder:updateRegion is an update for.

Since: 4.12

clearGLTextureBuilderUpdateTexture :: (MonadIO m, IsGLTextureBuilder o) => o -> m () Source #

Set the value of the “update-texture” property to Nothing. When overloading is enabled, this is equivalent to

clear #updateTexture

constructGLTextureBuilderUpdateTexture :: (IsGLTextureBuilder o, MonadIO m, IsTexture a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “update-texture” property. This is rarely needed directly, but it is used by new.

getGLTextureBuilderUpdateTexture :: (MonadIO m, IsGLTextureBuilder o) => o -> m (Maybe Texture) Source #

Get the value of the “update-texture” property. When overloading is enabled, this is equivalent to

get gLTextureBuilder #updateTexture

setGLTextureBuilderUpdateTexture :: (MonadIO m, IsGLTextureBuilder o, IsTexture a) => o -> a -> m () Source #

Set the value of the “update-texture” property. When overloading is enabled, this is equivalent to

set gLTextureBuilder [ #updateTexture := value ]

width

The width of the texture.

Since: 4.12

constructGLTextureBuilderWidth :: (IsGLTextureBuilder o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “width” property. This is rarely needed directly, but it is used by new.

getGLTextureBuilderWidth :: (MonadIO m, IsGLTextureBuilder o) => o -> m Int32 Source #

Get the value of the “width” property. When overloading is enabled, this is equivalent to

get gLTextureBuilder #width

setGLTextureBuilderWidth :: (MonadIO m, IsGLTextureBuilder o) => o -> Int32 -> m () Source #

Set the value of the “width” property. When overloading is enabled, this is equivalent to

set gLTextureBuilder [ #width := value ]