chalkboard-0.1: Combinators for building and processing 2D images.

Portabilityghc
Stabilityunstable
MaintainerAndy Gill <andygill@ku.edu>

Graphics.Chalkboard.Array

Contents

Description

This module coverts 2D arrays into Boards, and back, and supplies basic dithering algorithms.

Synopsis

Converters

boardToArraySource

Arguments

:: Average a 
=> (Int, Int)

the x,y size of the image to be captured. We assume the bottom left hand size is 0,0.

-> Int

the square root of the amount of super-sampling to be done. I recommend 3, which is 9 points.

-> Board a

the board to sample.

-> Array (Int, Int) a

the result array.

boardToArray turns a Board into a 2D Array (pixelization).

arrayToBoard :: (Lerp a, Scale a) => Array (Int, Int) a -> Board (Maybe a)Source

arrayToBoard turns a 2D Array into a Board, using bi-linear inteprelation.

Dithering

threshold :: Floating a => (a -> a) -> Array (Int, Int) a -> Array (Int, Int) aSource

threshold quantized based on a simple, pointwise function.

floydSteinberg :: Floating a => (a -> a) -> Array (Int, Int) a -> Array (Int, Int) aSource

floydSteinberg quantized using the Floyd Steinberg algorithm.