rullino
    Preparing search index...

    Variable ditherConst

    dither: MultipassFilter<
        {
            levels: {
                default: 2;
                description: "How many tones are kept per channel. 2 is pure black and white.";
                label: "Levels";
                max: 16;
                min: 2;
                type: "int";
            };
            matrix: {
                default: "bayer4";
                description: "The pattern that decides where each dot goes: ordered Bayer grids, random white noise, or the evenly spread R2 pattern.";
                label: "Pattern";
                options: {
                    bayer2: "Bayer 2×2";
                    bayer4: "Bayer 4×4";
                    bayer8: "Bayer 8×8";
                    gradient: "R2 (evenly spread)";
                    white: "White noise";
                };
                type: "enum";
            };
            mode: {
                default: "mono";
                description: "Mono dithers the brightness only; Colour dithers each colour channel.";
                label: "Colours";
                options: { color: "Colour"; mono: "Mono" };
                type: "enum";
            };
            scale: {
                default: 1;
                description: "Size of each pattern cell in pixels; larger gives a chunkier look.";
                label: "Cell size (px)";
                max: 16;
                min: 1;
                type: "int";
                unit: "px";
            };
            seed: {
                default: 0;
                description: "Changes the random pattern; only used by White noise.";
                label: "Noise seed";
                max: 999;
                min: 0;
                type: "int";
            };
        },
    > = ...

    Dithering to levels levels per channel, in sRGB-encoded units: each value is rounded down or up by comparing it with a threshold, so the local mean of the pattern keeps the tone. The threshold comes from a Bayer matrix (ordered, regular), white noise (a hash, seeded) or the R2 lattice (evenly spread, no visible grid). Mono dithers luminance into greys (a gradientMap after it turns them into any two or three colours). scale enlarges the pattern cells.