SFML-0.2.0.0: SFML bindings

Safe HaskellNone
LanguageHaskell98

SFML.Graphics.Texture

Synopsis

Documentation

module SFML.Utils

nullTexture :: Texture Source

A null texture.

createTexture Source

Arguments

:: Int

Texture width

-> Int

Texture height

-> IO (Either TextureException Texture) 

Create a new texture.

textureFromFile Source

Arguments

:: FilePath

Path of the image file to load

-> Maybe IntRect

Area of the source image to load (Nothing to load the entire image)

-> IO (Either TextureException Texture) 

Create a new texture from a file.

textureFromMemory Source

Arguments

:: Ptr a

Pointer to the file data in memory

-> Int

Size of the data to load, in bytes

-> Maybe IntRect

Area of the source image to load (Nothing to load the entire image)

-> IO (Either TextureException Texture) 

Create a new texture from a file in memory.

textureFromStream Source

Arguments

:: InputStream

Source stream to read from

-> Maybe IntRect

Area of the source image to load (Nothing to load the entire image)

-> IO (Either TextureException Texture) 

Create a new texture from a custom stream.

textureFromImage Source

Arguments

:: Image

Image to upload to the texture

-> Maybe IntRect

Area of the source image to load (Nothing to load the entire image)

-> IO (Either TextureException Texture) 

Create a new texture from an image.

copy :: SFCopyable a => a -> IO a Source

Copy the given SFML resource.

destroy :: SFResource a => a -> IO () Source

Destroy the given SFML resource.

textureSize :: Texture -> IO Vec2u Source

Return the size of the texture in pixels.

copyTextureToImage :: Texture -> IO Image Source

Copy a texture's pixels to an image

updateTextureFromPixels Source

Arguments

:: Texture

Texture to update

-> Ptr a

Array of pixels to copy to the texture

-> Int

Width of the pixel region contained in the pixels array

-> Int

Height of the pixel region contained in the pixels array

-> Int

X offset in the texture where to copy the source pixels

-> Int

Y offset in the texture where to copy the source pixels

-> IO () 

Update a texture from an array of pixels.

updateTextureFromImage Source

Arguments

:: Texture

Texture to update

-> Image

Image to copy to the texture

-> Int

X offset in the texture where to copy the source pixels

-> Int

Y offset in the texture where to copy the source pixels

-> IO () 

Update a texture from an image.

updateTextureFromWindow Source

Arguments

:: Texture

Texture to update

-> Window

Window to copy to the texture

-> Int

X offset in the texture where to copy the source pixels

-> Int

Y offset in the texture where to copy the source pixels

-> IO () 

Update a texture from the contents of a window.

updateTextureFromRenderWindow Source

Arguments

:: Texture

Texture to update

-> RenderWindow

Render-window to copy to the texture

-> Int

X offset in the texture where to copy the source pixels

-> Int

Y offset in the texture where to copy the source pixels

-> IO () 

Update a texture from the contents of a render-window.

bind :: SFBindable a => a -> IO () Source

Bind the resource for rendering (activate it).

This function is not part of the graphics API, it mustn't be used when drawing SFML entities. It must be used only if you mix sfShader with OpenGL code.

setSmooth :: SFSmoothTexture a => a -> Bool -> IO () Source

Enable or disable the smooth filter on a texture.

isSmooth :: SFSmoothTexture a => a -> IO Bool Source

Tell whether the smooth filter is enabled or not for a texture.

setRepeated :: Texture -> Bool -> IO () Source

Enable or disable repeating for a texture.

Repeating is involved when using texture coordinates outside the texture rectangle [0, 0, width, height]. In this case, if repeat mode is enabled, the whole texture will be repeated as many times as needed to reach the coordinate (for example, if the X texture coordinate is 3 * width, the texture will be repeated 3 times). If repeat mode is disabled, the "extra space" will instead be filled with border pixels.

Warning: on very old graphics cards, white pixels may appear when the texture is repeated. With such cards, repeat mode can be used reliably only if the texture has power-of-two dimensions (such as 256x128). Repeating is disabled by default.

isRepeated :: Texture -> IO Bool Source

Tell whether a texture is repeated or not

textureMaxSize :: Int Source

The maximum texture size allowed in pixels.