src/dither/diffusion

Types

Diffusor = concept d
    ## Defines the access patterns for a matrix of error diffusion values
    d.rows is int
    d.columns is int
    d.inset is int
    d.denominator
    d.numerator(int, int) is int
Quantizer[Color; Error] = concept q
    ## Determines the logic for how color errors are determined, manipulated and applied
    q.quantizeError(Color, Color) is Error
    (Error * int) is Error
    (Error div int) is Error
    (Error + Error) is Error
    (Color + Error) is Color

Procs

proc errorDiffusionDither[C, E](input: InputImage[C];
                                output: var OutputImage[C]; palette: Palette[C];
                                quantizer: Quantizer[C, E]; diffusor: Diffusor)
Implementation of error diffusion based dithering https://tannerhelland.com/2012/12/28/dithering-eleven-algorithms-source-code.html