Safe Haskell | None |
---|---|
Language | Haskell2010 |
- newtype TCODImage = TCODImage {
- unTCODImage :: Ptr ()
- imageNew :: Int -> Int -> IO TCODImage
- imageFromConsole :: TCODConsole -> IO TCODImage
- imageRefreshConsole :: TCODImage -> TCODConsole -> IO ()
- imageLoad :: FilePath -> IO TCODImage
- imageClear :: TCODImage -> Color -> IO ()
- imageInvert :: TCODImage -> IO ()
- imageHFlip :: TCODImage -> IO ()
- imageVFlip :: TCODImage -> IO ()
- imageRotate90 :: TCODImage -> Int -> IO ()
- imageScale :: TCODImage -> Int -> Int -> IO ()
- imageSave :: TCODImage -> FilePath -> IO ()
- imageGetSize :: TCODImage -> IO (Int, Int)
- imageGetPixel :: TCODImage -> Int -> Int -> IO Color
- imageGetAlpha :: TCODImage -> Int -> Int -> IO Int
- imageGetMipmapPixel :: TCODImage -> Float -> Float -> Float -> Float -> IO Color
- imagePutPixel :: TCODImage -> Int -> Int -> Color -> IO ()
- imageBlit :: TCODImage -> TCODConsole -> Float -> Float -> TCODBackgroundFlag -> Float -> Float -> Float -> IO ()
- imageBlitRect :: TCODImage -> TCODConsole -> Int -> Int -> Int -> Int -> TCODBackgroundFlag -> IO ()
- imageBlit2X :: TCODImage -> TCODConsole -> Int -> Int -> Int -> Int -> Int -> Int -> IO ()
- imageDelete :: TCODImage -> IO ()
- imageSetKeyColor :: TCODImage -> Color -> IO ()
- imageIsPixelTransparent :: TCODImage -> Int -> Int -> IO Bool
Documentation
TCOD image
TCODImage | |
|
You can create an image of any size, filled with black with this function.
imageFromConsole :: TCODConsole -> IO TCODImage Source #
You can create an image from any console (either the root console or an offscreen console). The image size will depend on the console size and the font characters size. You can then save the image to a file with the save function.
imageRefreshConsole :: TCODImage -> TCODConsole -> IO () Source #
If you need to refresh the image with the console's new content, you don't have to delete it and create another one. Instead, use this function. Note that you must use the same console that was used in the TCOD_image_from_console call (or at least a console with the same size).
imageLoad :: FilePath -> IO TCODImage Source #
You can read data from a .bmp or .png file (for example to draw an image using the background color of the console cells). Note that only 24bits and 32bits PNG files are currently supported.
imageInvert :: TCODImage -> IO () Source #
Inverting the colors of the image
imageHFlip :: TCODImage -> IO () Source #
Flipping the image horizontally
imageVFlip :: TCODImage -> IO () Source #
Flipping the image vertically
Rotate the image clockwise by increment of 90 degrees.
Rotate the image clockwise by increment of 90 degrees.
imageSave :: TCODImage -> FilePath -> IO () Source #
You can save an image to a 24 bits .bmp or .png file.
imageGetSize :: TCODImage -> IO (Int, Int) Source #
You can read the size of an image in pixels with this function.
imageGetPixel :: TCODImage -> Int -> Int -> IO Color Source #
You can read the colors from an image with this function.
imageGetAlpha :: TCODImage -> Int -> Int -> IO Int Source #
If you have set a key color for this image with setKeyColor, or if this image was created from a 32 bits PNG file (with alpha layer), you can get the pixel transparency with this function. This function returns a value between 0 (transparent pixel) and 255 (opaque pixel).
This method uses mipmaps to get the average color of an arbitrary rectangular region of the image. It can be used to draw a scaled-down version of the image. It's used by libtcod's blitting functions.
:: TCODImage | the image handler, obtained with the load function. |
-> TCODConsole | The console on which the image will be drawn. |
-> Float | x Coordinates in the console of the center of the image. |
-> Float | y Coordinates in the console of the center of the image. |
-> TCODBackgroundFlag | This flag defines how the cell's background color is modified. See |
-> Float | scale x Scale coefficient. Must be > 0.0. |
-> Float | scale y Scale coefficient. Must be > 0.0. |
-> Float | angle Rotation angle in radians. |
-> IO () |
Blitting with scaling and/or rotation
This function allows you to specify the floating point coordinates of the center of the image, its scale and its rotation angle.
:: TCODImage | the image handler, obtained with the load function. |
-> TCODConsole | The console on which the image will be drawn. |
-> Int | x Coordinates in the console of the upper-left corner of the image. |
-> Int | y Coordinates in the console of the upper-left corner of the image. |
-> Int | w Dimension of the image on the console. Use -1,-1 to use the image size. |
-> Int | h Dimension of the image on the console. Use -1,-1 to use the image size. |
-> TCODBackgroundFlag | This flag defines how the cell's background color is modified. See |
-> IO () |
This function blits a rectangular part of the image on a console without scaling it or rotating it. Each pixel of the image fills a console cell.
:: TCODImage | the image handler, obtained with the load function. |
-> TCODConsole | The console of which the image will be blited. Foreground, background and character data will be overwritten. |
-> Int | dx Coordinate of the console cell where the upper left corner of the blitted image will be. |
-> Int | dy Coordinate of the console cell where the upper left corner of the blitted image will be. |
-> Int | sx Part of the image to blit. Use -1 in w and h to blit the whole image. |
-> Int | sy Part of the image to blit. Use -1 in w and h to blit the whole image. |
-> Int | w Part of the image to blit. Use -1 in w and h to blit the whole image. |
-> Int | h Part of the image to blit. Use -1 in w and h to blit the whole image. |
-> IO () |
Blitting with subcell resolution
Eventually, you can use some special characters in the libtcod fonts to double the console resolution using this blitting function.
imageDelete :: TCODImage -> IO () Source #
Free memory of the image