bitmap-0.0.2: A library for handling and manipulating bitmaps (rectangular pixel arrays).

Safe HaskellSafe-Infered

Data.Bitmap.IO.File

Description

Saving and loading uncompressed bitmaps. For loading from compressed formats, see the stb-image library: http://hackage.haskell.org/package/stb-image.

The goal of this module is to provide the simplest possible interface for loading and saving bitmaps; so you can start experimenting without much hassle.

Note: Endianness is the endianness of the host, so the resulting file is not portable across platforms with different endiannesses.

Synopsis

Documentation

writeRawData :: PixelComponent t => FilePath -> IOBitmap t -> IO ()Source

Saves only the raw pixel data, no resolution etc.

hPutHeader :: PixelComponent t => Handle -> IOBitmap t -> IO ()Source

Writes a 16 byte header in the following format:

 dword xsize
 dword ysize
 dword nchn
 dword pixelcomponent_type

Pixel component encoding is the following:

  • 1 = Word8
  • 2 = Word16
  • 3 = Word32
  • 4 = Float

Endianness is the endianness of the host, so the resulting file is not portable across platform with different endiannesses.

hPutRawData :: PixelComponent t => Handle -> IOBitmap t -> IO ()Source

Saves only the raw pixel data, no resolution etc.