Trait rscolorq::SpatialQuant[][src]

pub trait SpatialQuant: Sized {
    fn calculate_filter_weights(
        dithering_level: f64,
        filter_size: FilterSize
    ) -> Matrix2d<Self>;
fn color_difference(&self, other: &Self) -> f64;
fn difference_threshold() -> f64;
fn direct_product(&self, other: &Self) -> Self;
fn dot_product(&self, other: &Self) -> f64;
fn norm_squared(&self) -> f64;
fn random(rng: &mut impl Rng) -> Self;
fn refine_palette(
        s: &mut Matrix2d<Self>,
        coarse_variables: &Matrix3d<f64>,
        a: &Matrix2d<Self>,
        palette: &mut Vec<Self>
    ) -> Result<(), QuantError>;
fn one() -> Self; }

A trait required to calculate the spatial quantization on a color type.

Required methods

fn calculate_filter_weights(
    dithering_level: f64,
    filter_size: FilterSize
) -> Matrix2d<Self>
[src]

Calculates the filter weights matrix based on the FilterSize.

fn color_difference(&self, other: &Self) -> f64[src]

Calculates the difference between two colors.

fn difference_threshold() -> f64[src]

Returns the minimal threshold before a color is considered to be different.

fn direct_product(&self, other: &Self) -> Self[src]

Multiplies the components of a color directly with the corresponding components of other.

fn dot_product(&self, other: &Self) -> f64[src]

Calculates the dot product.

fn norm_squared(&self) -> f64[src]

Calculate the squared magnitude of self and other.

fn random(rng: &mut impl Rng) -> Self[src]

Create a random color.

fn refine_palette(
    s: &mut Matrix2d<Self>,
    coarse_variables: &Matrix3d<f64>,
    a: &Matrix2d<Self>,
    palette: &mut Vec<Self>
) -> Result<(), QuantError>
[src]

Update the color palette.

fn one() -> Self[src]

Either one or the maximal intensity of the color type.

Note: This is included for thoroughness. It’s only used for the One filter size, and the One filter does not produce a usable result.

Loading content...

Implementations on Foreign Types

impl SpatialQuant for Lab<D65, f64>[src]

Loading content...

Implementors

impl SpatialQuant for Rgb[src]

Loading content...