SFML-2.3.2.2: SFML bindings

Safe HaskellNone
LanguageHaskell98

SFML.Graphics.Texture

Synopsis

Documentation

module SFML.Utils

nullTexture :: Texture

A null texture.

createTexture

Arguments

:: Int

Texture width

-> Int

Texture height

-> IO (Either SFException Texture) 

Create a new texture.

textureFromFile

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

Create a new texture from a file.

textureFromMemory

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

Create a new texture from a file in memory.

textureFromStream

Arguments

:: InputStream

Source stream to read from

-> Maybe IntRect

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

-> IO (Either SFException Texture) 

Create a new texture from a custom stream.

textureFromImage

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

Create a new texture from an image.

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

Copy the given SFML resource.

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

Destroy the given SFML resource.

textureSize :: Texture -> IO Vec2u

Return the size of the texture in pixels.

copyTextureToImage :: Texture -> IO Image

Copy a texture's pixels to an image

updateTextureFromPixels

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

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

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

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

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

Enable or disable the smooth filter on a texture.

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

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

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

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

Tell whether a texture is repeated or not

textureMaxSize :: Int

The maximum texture size allowed in pixels.