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

Safe HaskellSafe-Infered

Data.Bitmap.IO.Pixels

Contents

Description

Accessing individual pixels.

Synopsis

Types

data IOBitmap1 t Source

Newtypes for mutable bitmaps with a fixed number of channels (components per pixel)

Reading and writing pixels

withComponentPtrSource

Arguments

:: PixelComponent t 
=> IOBitmap t

the bitmap

-> Offset

position (x,y)

-> Int

channel index {0,1,...,nchannels-1}

-> (Ptr t -> IO a)

user action

-> IO a 

Note that the resulting pointer is valid only within a line (because of the padding)

unsafeReadComponentSource

Arguments

:: PixelComponent t 
=> IOBitmap t

the bitmap

-> Offset

position (x,y)

-> Int

channel index {0,1,...,nchannels-1}

-> IO t 

It is not very efficient to read/write lots of pixels this way.

unsafeWriteComponentSource

Arguments

:: PixelComponent t 
=> IOBitmap t

the bitmap

-> Offset

position (x,y)

-> Int

channel index {0,1,...,nchannels-1}

-> t

the value to write

-> IO () 

unsafeReadComponentsSource

Arguments

:: PixelComponent t 
=> IOBitmap t

the bitmap

-> Offset

position (x,y)

-> Int

channel index {0,1,...,nchannels-1}

-> Int

the number of components to read

-> IO [t] 

Please note that the component array to read shouldn't cross the boundary between lines.

unsafeWriteComponentsSource

Arguments

:: PixelComponent t 
=> IOBitmap t

the bitmap

-> Offset

position (x,y)

-> Int

channel index {0,1,...,nchannels-1}

-> [t]

the components to write

-> IO () 

Please note that the component array to write shouldn't cross the boundary between lines.

unsafeReadPixelSource

Arguments

:: PixelComponent t 
=> IOBitmap t

the bitmap

-> Offset

position (x,y)

-> IO [t]