dither_float_2d

Function dither_float_2d 

Source
pub fn dither_float_2d<Src, Dest, M: SpatialRng>(
    value: Src,
    x: u32,
    y: u32,
    method: &M,
) -> Dest
Expand description

Dither a float value when converting to lower precision using 2D spatial RNG method.

This is ideal for images and textures where spatial coordinates provide better dithering patterns.

ยงExample

use dithereens::{InterleavedGradientNoise, dither_float_2d};

let value: f32 = 1.234567;
let method = InterleavedGradientNoise::new(42);
let result: f16 = dither_float_2d(value, 10, 20, &method);