Gamgine-0.5: Some kind of game library or set of utilities.

Copyright(c) Marko Lauronen 2008
LicenseBSD
Maintainermarko.lauronen@pp1.inet.fi
Stabilityexperimental
Portabilitynon-portable (GHC only)
Safe HaskellNone
LanguageHaskell98

Gamgine.Image.PNG

Contents

Description

A simple, pure Haskell PNG loader. Currently supports 24bit RGB(A) images with no interlacing. Also lacks support for color indexed (paletted) images.

The image is stored in a StorableArray for compatibility with OpenGL (the array supports getting Ptr Word8 to the image data using withStorableArray function).

Synopsis

Types

data PNGImage Source

Instances

Functions

loadPNGFile :: FilePath -> IO (Either String PNGImage) Source

Load a PNG file, Left value contains a description of a problem as a String, if any

dimensions :: PNGImage -> (Width, Height) Source

Get dimensions of the image (in pixels)

imageData :: PNGImage -> StorableArray (Int, Int) Word8 Source

Get image data as C-compatible StorableArray

hasAlphaChannel :: PNGImage -> Bool Source

Check if the image has alpha channel