gloss-1.9.3.1: Painless 2D vector graphics, animations and simulations.

Safe Haskell | None
Language | Haskell98

Graphics.Gloss.Data.Bitmap

Description

Functions to load bitmap data from various places.

Synopsis

- data BitmapData :: *
- bitmapOfForeignPtr :: Int -> Int -> ForeignPtr Word8 -> Bool -> Picture
- bitmapOfByteString :: Int -> Int -> ByteString -> Bool -> Picture
- bitmapOfBMP :: BMP -> Picture
- loadBMP :: FilePath -> IO Picture

# Documentation

data BitmapData :: *

Abstract 32-bit RGBA bitmap data.

Instances

Eq BitmapData |
Data BitmapData |
Show BitmapData |

bitmapOfForeignPtr :: Int -> Int -> ForeignPtr Word8 -> Bool -> Picture

O(1). Use a `ForeignPtr` of RGBA data as a bitmap with the given width and height.

bitmapOfByteString :: Int -> Int -> ByteString -> Bool -> Picture

O(size). Copy a `ByteString` of RGBA data into a bitmap with the given width and height.

The boolean flag controls whether Gloss should cache the data between frames for speed. If you are programatically generating the image for each frame then use `False`. If you have loaded it from a file then use `True`.

bitmapOfBMP :: BMP -> Picture

O(size). Copy a `BMP` file into a bitmap.

loadBMP :: FilePath -> IO Picture

Load an uncompressed 24 or 32bit RGBA BMP file as a bitmap.