|
|
|
|
|
Description |
Implements a loader for BMP files of uncompressed 24Bit RGB format.
Trying to load any other format will cause errors to be thrown.
|
|
Synopsis |
|
|
|
Documentation |
|
data FileHeader |
BMP File Header.
| Constructors | FileHeader | | fileType :: Word16 | +0. magic bytes, 0x42 0x4d.
| fileSize :: Word32 | +2. size of the file in bytes.
| fileReserved1 :: Word16 | +6. unused, must be zero.
| fileReserved2 :: Word16 | +8. unused, must be zero.
| fileOffset :: Word32 | +10. offset in bytes to start of pixel data.
|
|
| Instances | |
|
|
data ImageHeader |
BMP Image header.
| Constructors | ImageHeader | | imageSize :: Word32 | +0. size of the image header, in bytes.
| imageWidth :: Word32 | +4. width of the image, in pixels.
| imageHeight :: Word32 | +8. height of the image, in pixels.
| imagePlanes :: Word16 | +12. number of color planes.
| imageBitCount :: Word16 | +14. number of bits per pixel.
| imageCompression :: Word32 | +16. image compression, 0 = uncompressed.
| imageSizeImage :: Word32 | +20. size of image, may be 0 for uncompressed.
| imagePelsPerMeterX :: Word32 | +24. prefered resolution in pixels per meter.
| imagePelsPerMeterY :: Word32 | +28.
| imageClrUsed :: Word32 | +32. number of color entries that are used
| imageClrImportant :: Word32 | +36. number of significant colors
|
|
| Instances | |
|
|
imageHeaderSize :: Int |
Length of the BMP image header, in bytes.
|
|
fileHeaderSize :: Int |
Length of the BMP file header, in bytes.
|
|
peekFileHeader :: Ptr Word8 -> IO FileHeader |
Marshals a BMP file header from raw data.
|
|
peekImageHeader :: Ptr Word8 -> IO ImageHeader |
Marshals a BMP image header from raw data.
|
|
convertImage |
:: (?transColor :: (Word8, Word8, Word8)) | Transparency color.
| -> (?ptrDest :: Ptr Word8) | Pointer to destination image.
| -> (?ptrSrc :: Ptr Word8) | Pointer to source image.
| -> (?width :: Int) | Width of image in pixels.
| -> (?height :: Int) | Height of image in pixels.
| -> (?slackPerLine :: Int) | Number of bytes of slack space per line.
| -> Int | X position in the image.
| -> Int | Y position in the image.
| -> Int | Offset into source image, in bytes.
| -> Int | Offset into destination image, in bytes.
| -> IO () | | Performs conversion between 24bit RGB and 32bit RGBA.
|
|
|
peekLSB32 :: Ptr Word8 -> IO Word32 |
Loads and converts a 32bit LSB word to machine representation.
|
|
peekLSB16 :: Ptr Word8 -> IO Word16 |
Loads and converts a 16bit LSB word to machine representation.
|
|
loadBMP24 |
:: (Word8, Word8, Word8) | The RGB color to treat as transparent.
If a pixel in the BMP file has this color then the corresponding
pixel in the loaded image with have an alpha value of 0. All
other pixels in the loaded image will have an alpha of 1.
| -> FilePath | Path to the image file.
| -> IO (FileHeader, ImageHeader, Ptr Word8) | | Loads a BMP file in uncompressed 24bit RGB format.
The resulting data is in uncompressed 32bit RGBA format.
|
|
|
Produced by Haddock version 0.7 |