Module

Puregrain.Internal.Image

Package
purescript-puregrain
Repository
roman-mkh/puregrain

The two drivers that run the diffusion over a whole image, row by row, with any Fifo backend and any conversion to light: ditherImageVia over an array of rows (all at once) and ditherRowsVia over a lazy list of rows (each when asked for). Both drive the same stepRow, so they give the same result; a row of a different length, a Left from stepRow, becomes a runtime error here, since neither result type can carry it. Internal: Puregrain.Dither exports them with the production backend; the tests use them to check every backend against a reference.

#ditherImageVia Source

ditherImageVia :: forall f a. Fifo f => Ring a => Scalable a => Proxy f -> Conversion a -> Kernel -> Quantize a -> Array (Array a) -> Array (Array a)

An image in memory: a strict fold over the array of rows.

#ditherRowsVia Source

ditherRowsVia :: forall f a. Fifo f => Ring a => Scalable a => Proxy f -> Conversion a -> Kernel -> Quantize a -> List (Array a) -> List (Array a)

A stream of rows: a lazy unfold over the list of rows.

#rowsIn Source

rowsIn :: forall a. Conversion a -> Array a -> Array a

A row converted to light before it's dithered, or left as it is when the conversion is off.

#rowsOut Source

rowsOut :: forall a. Conversion a -> Array a -> Array a

A dithered row converted back from light, or left as it is when the conversion is off.