Portability | ghc |
---|---|

Stability | unstable |

Maintainer | Andy Gill <andygill@ku.edu> |

This module coverts 2D arrays into `Board`

s, and back, and supplies basic dithering algorithms.

- boardToArray :: Average a => (Int, Int) -> Int -> Board a -> Array (Int, Int) a
- arrayToBoard :: (Lerp a, Scale a) => Array (Int, Int) a -> Board (Maybe a)
- threshold :: Floating a => (a -> a) -> Array (Int, Int) a -> Array (Int, Int) a
- floydSteinberg :: Floating a => (a -> a) -> Array (Int, Int) a -> Array (Int, Int) a
- widthHeight :: Array (Int, Int) a -> (Int, Int)

# Converters

:: 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.