Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
No description available in the introspection data.
Synopsis
- newtype Texture = Texture (ManagedPtr Texture)
- class (ManagedPtrNewtype o, IsDescendantOf Texture o) => IsTexture o
- textureAllocate :: (HasCallStack, MonadIO m, IsTexture a) => a -> m Int32
- textureCopySubImage :: (HasCallStack, MonadIO m, IsTexture a) => a -> Int32 -> Int32 -> Int32 -> Int32 -> Word64 -> Word64 -> m Int32
- textureGetComponents :: (HasCallStack, MonadIO m, IsTexture a) => a -> m TextureComponents
- textureGetData :: (HasCallStack, MonadIO m, IsTexture a) => a -> PixelFormat -> Word32 -> Word8 -> m Int32
- textureGetGlTexture :: (HasCallStack, MonadIO m, IsTexture a) => a -> m (Int32, Word32, Word32)
- textureGetHeight :: (HasCallStack, MonadIO m, IsTexture a) => a -> m Word32
- textureGetMaxWaste :: (HasCallStack, MonadIO m, IsTexture a) => a -> m Int32
- textureGetPremultiplied :: (HasCallStack, MonadIO m, IsTexture a) => a -> m Int32
- textureGetWidth :: (HasCallStack, MonadIO m, IsTexture a) => a -> m Word32
- textureIsSliced :: (HasCallStack, MonadIO m, IsTexture a) => a -> m Int32
- textureSetComponents :: (HasCallStack, MonadIO m, IsTexture a) => a -> TextureComponents -> m ()
- textureSetPremultiplied :: (HasCallStack, MonadIO m, IsTexture a) => a -> Int32 -> m ()
- textureSetRegion :: (HasCallStack, MonadIO m, IsTexture a) => a -> Int32 -> Int32 -> Int32 -> Int32 -> Word32 -> Word32 -> Int32 -> Int32 -> PixelFormat -> Word32 -> Word8 -> m Int32
Exported types
Memory-managed wrapper type.
Instances
Eq Texture Source # | |
BoxedPtr Texture Source # | |
Defined in GI.Cogl.Interfaces.Texture boxedPtrCopy :: Texture -> IO Texture boxedPtrFree :: Texture -> IO () | |
ManagedPtrNewtype Texture Source # | |
Defined in GI.Cogl.Interfaces.Texture toManagedPtr :: Texture -> ManagedPtr Texture |
class (ManagedPtrNewtype o, IsDescendantOf Texture o) => IsTexture o Source #
Type class for types which implement Texture
.
Instances
(ManagedPtrNewtype o, IsDescendantOf Texture o) => IsTexture o Source # | |
Defined in GI.Cogl.Interfaces.Texture |
Methods
Click to display all available methods, including inherited ones
Methods
allocate, copySubImage, isSliced.
Getters
getComponents, getData, getGlTexture, getHeight, getMaxWaste, getPremultiplied, getWidth.
Setters
allocate
:: (HasCallStack, MonadIO m, IsTexture a) | |
=> a |
|
-> m Int32 | Returns: |
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
:: (HasCallStack, MonadIO m, IsTexture a) | |
=> a |
|
-> 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
:: (HasCallStack, MonadIO m, IsTexture a) | |
=> a |
|
-> PixelFormat |
|
-> Word32 |
|
-> Word8 |
|
-> 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
:: (HasCallStack, MonadIO m, IsTexture a) | |
=> a |
|
-> m (Int32, Word32, Word32) | Returns: |
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
:: (HasCallStack, MonadIO m, IsTexture a) | |
=> a |
|
-> m Word32 | Returns: the height of the GPU side texture in pixels |
Queries the height of a cogl texture.
getMaxWaste
:: (HasCallStack, MonadIO m, IsTexture a) | |
=> a |
|
-> m Int32 | Returns: the maximum waste |
Queries the maximum wasted (unused) pixels in one dimension of a GPU side texture.
getPremultiplied
textureGetPremultiplied Source #
:: (HasCallStack, MonadIO m, IsTexture a) | |
=> a |
|
-> m Int32 | Returns: |
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
:: (HasCallStack, MonadIO m, IsTexture a) | |
=> a |
|
-> m Word32 | Returns: the width of the GPU side texture in pixels |
Queries the width of a cogl texture.
isSliced
:: (HasCallStack, MonadIO m, IsTexture a) | |
=> a |
|
-> m Int32 | Returns: |
Queries if a texture is sliced (stored as multiple GPU side tecture objects).
setComponents
:: (HasCallStack, MonadIO m, IsTexture a) | |
=> a |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsTexture a) | |
=> a |
|
-> Int32 |
|
-> 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
:: (HasCallStack, MonadIO m, IsTexture a) | |
=> a |
|
-> Int32 |
|
-> Int32 |
|
-> Int32 |
|
-> Int32 |
|
-> Word32 |
|
-> Word32 |
|
-> Int32 |
|
-> Int32 |
|
-> PixelFormat |
|
-> Word32 |
|
-> Word8 |
|
-> m Int32 | Returns: |
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>