Puregrain.Internal.Quantize
- Package
- purescript-puregrain
- Repository
- roman-mkh/puregrain
Quantize's inside, for the drivers that resolve a quantizer once per
run. Internal: may change without notice. Puregrain.Quantize
re-exports the type, opaquely, with its constructors and runner.
#Quantize Source
newtype Quantize aA quantizer: picks a pixel's output value; a is the pixel type.
Build one with quantize, or quantizeWith when the decision depends
on the pixel's position; run one with runQuantize. Opaque, so its
representation can change without breaking anyone.
It gets the pixel's corrected value, with the error diffused into it
already added, and must be total: accumulated error pushes values
beyond the nominal range, below 0 or above 255, and the quantizer must
still return a sensible value. ditherImage diffuses the difference
between the corrected value and the output to the neighbours.
Constructors
Quantize (Conversion a -> Context -> a -> a)
#quantizerFor Source
quantizerFor :: forall a. Conversion a -> Quantize a -> Quantizer aA quantizer resolved with the driver's conversion, once per run. Bind
the result and call it for every pixel: calling quantizerFor again
for each pixel would redo the quantizer's preparation each time, since
PureScript shares nothing by itself.
- Modules
- Puregrain
- Puregrain.
Cells - Puregrain.
Dither - Puregrain.
Gamma - Puregrain.
Internal. Exact - Puregrain.
Internal. Fifo - Puregrain.
Internal. Gamma - Puregrain.
Internal. Image - Puregrain.
Internal. Kernel - Puregrain.
Internal. Quantize - Puregrain.
Internal. Row - Puregrain.
Internal. SelfCheck - Puregrain.
Internal. State - Puregrain.
Internal. Step - Puregrain.
Internal. Util - Puregrain.
Kernel - Puregrain.
Machine. C64 - Puregrain.
Machine. ZxSpectrum - Puregrain.
Ordered - Puregrain.
Palette - Puregrain.
Palette. Presets - Puregrain.
Pixel - Puregrain.
Quantize - Puregrain.
SelfCheck