gi-cogl-1.0.5: COGL GObject bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Cogl.Interfaces.Texture

Description

No description available in the introspection data.

Synopsis

Exported types

newtype Texture Source #

Memory-managed wrapper type.

Constructors

Texture (ManagedPtr Texture) 

Instances

Instances details
Eq Texture Source # 
Instance details

Defined in GI.Cogl.Interfaces.Texture

Methods

(==) :: Texture -> Texture -> Bool #

(/=) :: Texture -> Texture -> Bool #

BoxedPtr Texture Source # 
Instance details

Defined in GI.Cogl.Interfaces.Texture

ManagedPtrNewtype Texture Source # 
Instance details

Defined in GI.Cogl.Interfaces.Texture

Methods

toManagedPtr :: Texture -> ManagedPtr Texture

class (ManagedPtrNewtype o, IsDescendantOf Texture o) => IsTexture o Source #

Type class for types which implement Texture.

Instances

Instances details
(ManagedPtrNewtype o, IsDescendantOf Texture o) => IsTexture o Source # 
Instance details

Defined in GI.Cogl.Interfaces.Texture

Methods

Click to display all available methods, including inherited ones

Expand

Methods

allocate, copySubImage, isSliced.

Getters

getComponents, getData, getGlTexture, getHeight, getMaxWaste, getPremultiplied, getWidth.

Setters

setComponents, setPremultiplied, setRegion.

allocate

textureAllocate Source #

Arguments

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

texture: A CoglTexture

-> m Int32

Returns: True if the texture was successfully allocated, otherwise False and error will be updated if it wasn't Nothing. (Can throw GError)

Explicitly allocates the storage for the given texture which allows you to be sure that there is enough memory for the texture and if not then the error can be handled gracefully.

<note>Normally applications don't need to use this api directly since the texture will be implicitly allocated when data is set on the texture, or if the texture is attached to a Offscreen framebuffer and rendered too.</note>

copySubImage

textureCopySubImage :: (HasCallStack, MonadIO m, IsTexture a) => a -> Int32 -> Int32 -> Int32 -> Int32 -> Word64 -> Word64 -> m Int32 Source #

No description available in the introspection data.

getComponents

textureGetComponents Source #

Arguments

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

texture: a CoglTexture pointer.

-> m TextureComponents 

Queries what components the given texture stores internally as set via textureSetComponents.

For textures created by the ‘_with_size’ constructors the default is TextureComponentsRgba. The other constructors which take a CoglBitmap or a data pointer default to the same components as the pixel format of the data.

Since: 1.18

getData

textureGetData Source #

Arguments

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

texture: a CoglTexture pointer.

-> PixelFormat

format: the PixelFormat to store the texture as.

-> Word32

rowstride: the rowstride of data in bytes or pass 0 to calculate from the bytes-per-pixel of format multiplied by the texture width.

-> Word8

data: memory location to write the texture's contents, or Nothing to only query the data size through the return value.

-> m Int32

Returns: the size of the texture data in bytes

Copies the pixel data from a cogl texture to system memory.

<note>Don't pass the value of cogl_texture_get_rowstride() as the rowstride argument, the rowstride should be the rowstride you want for the destination data buffer not the rowstride of the source texture</note>

getGlTexture

textureGetGlTexture Source #

Arguments

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

texture: a CoglTexture pointer.

-> m (Int32, Word32, Word32)

Returns: True if the handle was successfully retrieved, False if the handle was invalid

Queries the GL handles for a GPU side texture through its CoglTexture.

If the texture is spliced the data for the first sub texture will be queried.

getHeight

textureGetHeight Source #

Arguments

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

texture: a CoglTexture pointer.

-> m Word32

Returns: the height of the GPU side texture in pixels

Queries the height of a cogl texture.

getMaxWaste

textureGetMaxWaste Source #

Arguments

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

texture: a CoglTexture pointer.

-> m Int32

Returns: the maximum waste

Queries the maximum wasted (unused) pixels in one dimension of a GPU side texture.

getPremultiplied

textureGetPremultiplied Source #

Arguments

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

texture: a CoglTexture pointer.

-> m Int32

Returns: True if red, green and blue components are internally stored pre-multiplied by the alpha value or False if not.

Queries the pre-multiplied alpha status for internally stored red, green and blue components for the given texture as set by textureSetPremultiplied.

By default the pre-multipled state is tRUE.

Since: 1.18

getWidth

textureGetWidth Source #

Arguments

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

texture: a CoglTexture pointer.

-> m Word32

Returns: the width of the GPU side texture in pixels

Queries the width of a cogl texture.

isSliced

textureIsSliced Source #

Arguments

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

texture: a CoglTexture pointer.

-> m Int32

Returns: True if the texture is sliced, False if the texture is stored as a single GPU texture

Queries if a texture is sliced (stored as multiple GPU side tecture objects).

setComponents

textureSetComponents Source #

Arguments

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

texture: a CoglTexture pointer.

-> TextureComponents 
-> m () 

Affects the internal storage format for this texture by specifying what components will be required for sampling later.

This api affects how data is uploaded to the GPU since unused components can potentially be discarded from source data.

For textures created by the ‘_with_size’ constructors the default is TextureComponentsRgba. The other constructors which take a CoglBitmap or a data pointer default to the same components as the pixel format of the data.

Note that the TextureComponentsRg format is not available on all drivers. The availability can be determined by checking for the COGL_FEATURE_ID_TEXTURE_RG feature. If this format is used on a driver where it is not available then TextureErrorFormat will be raised when the texture is allocated. Even if the feature is not available then PixelFormatRg88 can still be used as an image format as long as TextureComponentsRg isn't used as the texture's components.

Since: 1.18

setPremultiplied

textureSetPremultiplied Source #

Arguments

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

texture: a CoglTexture pointer.

-> Int32

premultiplied: Whether any internally stored red, green or blue components are pre-multiplied by an alpha component.

-> m () 

Affects the internal storage format for this texture by specifying whether red, green and blue color components should be stored as pre-multiplied alpha values.

This api affects how data is uploaded to the GPU since Cogl will convert source data to have premultiplied or unpremultiplied components according to this state.

For example if you create a texture via cogl_texture_2d_new_with_size() and then upload data via cogl_texture_set_data() passing a source format of PixelFormatRgba8888 then Cogl will internally multiply the red, green and blue components of the source data by the alpha component, for each pixel so that the internally stored data has pre-multiplied alpha components. If you instead upload data that already has pre-multiplied components by passing PixelFormatRgba8888Pre as the source format to cogl_texture_set_data() then the data can be uploaded without being converted.

By default the premultipled state is tRUE.

Since: 1.18

setRegion

textureSetRegion Source #

Arguments

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

texture: a CoglTexture.

-> Int32

srcX: upper left coordinate to use from source data.

-> Int32

srcY: upper left coordinate to use from source data.

-> Int32

dstX: upper left destination horizontal coordinate.

-> Int32

dstY: upper left destination vertical coordinate.

-> Word32

dstWidth: width of destination region to write. (Must be less than or equal to width)

-> Word32

dstHeight: height of destination region to write. (Must be less than or equal to height)

-> Int32

width: width of source data buffer.

-> Int32

height: height of source data buffer.

-> PixelFormat

format: the PixelFormat used in the source buffer.

-> Word32

rowstride: rowstride of source buffer (computed from width if none specified)

-> Word8

data: the actual pixel data.

-> m Int32

Returns: True if the subregion upload was successful, and False otherwise

Sets the pixels in a rectangular subregion of texture from an in-memory buffer containing pixel data.

<note>The region set can't be larger than the source data</note>