- data Image
- type Size = (Int, Int)
- type Point = (Int, Int)
- type Color = CInt
- newImage :: Size -> IO Image
- copyImage :: Image -> IO Image
- withImage :: IO Image -> (Image -> IO b) -> IO b
- loadJpegFile :: FilePath -> IO Image
- loadJpegData :: Int -> Ptr a -> IO Image
- loadPngFile :: FilePath -> IO Image
- loadPngData :: Int -> Ptr a -> IO Image
- loadGifFile :: FilePath -> IO Image
- loadGifData :: Int -> Ptr a -> IO Image
- saveJpegFile :: Int -> FilePath -> Image -> IO ()
- savePngFile :: FilePath -> Image -> IO ()
- saveGifFile :: FilePath -> Image -> IO ()
- imageSize :: Image -> IO (Int, Int)
- resizeImage :: Int -> Int -> Image -> IO Image
- rotateImage :: Int -> Image -> IO Image
- fillImage :: Color -> Image -> IO ()
- drawFilledRectangle :: Point -> Point -> Color -> Image -> IO ()
- drawFilledEllipse :: Point -> Size -> Color -> Image -> IO ()
- drawLine :: Point -> Point -> Color -> Image -> IO ()
- drawArc :: Point -> Size -> Int -> Int -> Color -> Image -> IO ()
- antiAliased :: (Color -> Image -> IO a) -> Color -> Image -> IO a
- setPixel :: Point -> Color -> Image -> IO ()
- rgb :: Int -> Int -> Int -> Color
- rgba :: Int -> Int -> Int -> Int -> Color
Types
Creating and copying images
Memory management
:: IO Image | Image creation action. |
-> (Image -> IO b) | Some operation on the image. The result should
not reference the |
-> IO b |
Creates an image, performs an operation on the image, and
frees it.
This function allows block scoped management of Image
objects.
If you are handling large images, the delay before the finalizer which frees
the image runs may cause significant temporary extra memory use.
Use this function to force the image to be freed as soons as you are done with it.
Note that it is unsafe to hold on to the Image
after the
function is done.
Loading images
JPEG
loadJpegFile :: FilePath -> IO ImageSource
Load a JPEG image from a file.
Load a JPEG image from a buffer.
PNG
loadPngFile :: FilePath -> IO ImageSource
Load a PNG image from a file.
Load a PNG image from a buffer.
GIF
loadGifFile :: FilePath -> IO ImageSource
Load a GIF image from a file.
Load a GIF image from a buffer.
Saving images
JPEG
Save an image as a JPEG file.
PNG
GIF
Getting image information
Manipulating images
Resize an image to a give size.
Rotate an image by a multiple of 90 degrees counter-clockwise.
Drawing
antiAliased :: (Color -> Image -> IO a) -> Color -> Image -> IO aSource
Use anti-aliasing when performing the given drawing function. This can cause a segault with some gd versions.