Trait rscolorq::SpatialQuant [−][src]
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]
dithering_level: f64,
filter_size: FilterSize
) -> Matrix2d<Self>
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]
s: &mut Matrix2d<Self>,
coarse_variables: &Matrix3d<f64>,
a: &Matrix2d<Self>,
palette: &mut Vec<Self>
) -> Result<(), QuantError>
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.
Implementations on Foreign Types
impl SpatialQuant for Lab<D65, f64>
[src]
fn calculate_filter_weights(
dithering_level: f64,
filter_size: FilterSize
) -> Matrix2d<Self>
[src]
dithering_level: f64,
filter_size: FilterSize
) -> Matrix2d<Self>
fn color_difference(&self, other: &Self) -> f64
[src]
fn difference_threshold() -> f64
[src]
fn direct_product(&self, other: &Self) -> Self
[src]
fn dot_product(&self, other: &Self) -> f64
[src]
fn one() -> Self
[src]
fn norm_squared(&self) -> f64
[src]
fn random(rng: &mut impl Rng) -> Self
[src]
fn refine_palette(
s: &mut Matrix2d<Self>,
coarse_variables: &Matrix3d<f64>,
a: &Matrix2d<Self>,
palette: &mut Vec<Self>
) -> Result<(), QuantError>
[src]
s: &mut Matrix2d<Self>,
coarse_variables: &Matrix3d<f64>,
a: &Matrix2d<Self>,
palette: &mut Vec<Self>
) -> Result<(), QuantError>
Implementors
impl SpatialQuant for Rgb
[src]
fn calculate_filter_weights(
dithering_level: f64,
filter_size: FilterSize
) -> Matrix2d<Self>
[src]
dithering_level: f64,
filter_size: FilterSize
) -> Matrix2d<Self>
fn color_difference(&self, other: &Self) -> f64
[src]
fn difference_threshold() -> f64
[src]
fn direct_product(&self, other: &Self) -> Self
[src]
fn dot_product(&self, other: &Self) -> f64
[src]
fn one() -> Self
[src]
fn norm_squared(&self) -> f64
[src]
fn random(rng: &mut impl Rng) -> Self
[src]
fn refine_palette(
s: &mut Matrix2d<Self>,
coarse_variables: &Matrix3d<f64>,
a: &Matrix2d<Self>,
palette: &mut Vec<Self>
) -> Result<(), QuantError>
[src]
s: &mut Matrix2d<Self>,
coarse_variables: &Matrix3d<f64>,
a: &Matrix2d<Self>,
palette: &mut Vec<Self>
) -> Result<(), QuantError>