Safe Haskell | None |
---|---|
Language | Haskell98 |
SFML.Graphics.Texture
- module SFML.Utils
- nullTexture :: Texture
- createTexture :: Int -> Int -> IO (Either SFException Texture)
- textureFromFile :: FilePath -> Maybe IntRect -> IO (Either SFException Texture)
- textureFromMemory :: Ptr a -> Int -> Maybe IntRect -> IO (Either SFException Texture)
- textureFromStream :: InputStream -> Maybe IntRect -> IO (Either SFException Texture)
- textureFromImage :: Image -> Maybe IntRect -> IO (Either SFException Texture)
- copy :: SFCopyable a => a -> IO a
- destroy :: SFResource a => a -> IO ()
- textureSize :: Texture -> IO Vec2u
- copyTextureToImage :: Texture -> IO Image
- updateTextureFromPixels :: Texture -> Ptr a -> Int -> Int -> Int -> Int -> IO ()
- updateTextureFromImage :: Texture -> Image -> Int -> Int -> IO ()
- updateTextureFromWindow :: Texture -> Window -> Int -> Int -> IO ()
- updateTextureFromRenderWindow :: Texture -> RenderWindow -> Int -> Int -> IO ()
- bind :: SFBindable a => a -> IO ()
- setSmooth :: SFSmoothTexture a => a -> Bool -> IO ()
- isSmooth :: SFSmoothTexture a => a -> IO Bool
- setRepeated :: Texture -> Bool -> IO ()
- isRepeated :: Texture -> IO Bool
- textureMaxSize :: Int
Documentation
module SFML.Utils
A null texture.
Create a new texture.
Arguments
:: FilePath | Path of the image file to load |
-> Maybe IntRect | Area of the source image to load ( |
-> IO (Either SFException Texture) |
Create a new texture from a file.
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 ( |
-> IO (Either SFException Texture) |
Create a new texture from a file in memory.
Arguments
:: InputStream | Source stream to read from |
-> Maybe IntRect | Area of the source image to load ( |
-> IO (Either SFException Texture) |
Create a new texture from a custom stream.
Arguments
:: Image | Image to upload to the texture |
-> Maybe IntRect | Area of the source image to load ( |
-> 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
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.
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.
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.
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
The maximum texture size allowed in pixels.