Struct rscolorq::Params[][src]

pub struct Params<T: SpatialQuant> { /* fields omitted */ }

Input parameter struct for spatial color quantization and simulated annealing. The parameters can be validated with verify_parameters before quantization.

If a palette is supplied to the struct, the dithering will be performed with fixed colors and will override the palette_size field.

Implementations

impl<T: SpatialQuant> Params<T>[src]

pub fn new() -> Self[src]

Crate a new input parameter struct.

pub fn initial_temp(&mut self, initial_temp: f64) -> &mut Self[src]

Set the initial temperature. This must be greater than 0 and greater than the final temperature.

pub fn final_temp(&mut self, final_temp: f64) -> &mut Self[src]

Set the final temperature. This value must be greater than 0 and less than the initial temperature.

pub fn palette_size(&mut self, palette_size: u8) -> &mut Self[src]

Set the desired palette size. This parameter must be greater than 2.

pub fn iters_per_level(&mut self, iters_per_level: usize) -> &mut Self[src]

Set the iterations per level. This parameter must be greater than 0.

pub fn repeats_per_temp(&mut self, repeats_per_temp: usize) -> &mut Self[src]

Set the amount of repeats per temperature. This parameter must be greater than 0.

pub fn seed(&mut self, seed: Option<u64>) -> &mut Self[src]

Set the random number generator seed.

pub fn filter_size(&mut self, filter_size: FilterSize) -> &mut Self[src]

Set the filter size for quantization. The default is 3.

pub fn dithering_level(&mut self, dithering_level: f64) -> &mut Self[src]

Set the dithering level manually, default is 0.8. The range should be between roughly 0.5 and 1.5, higher numbers will result in higher frequency noise.

Dithering level must be greater than 0.

pub fn dithering_level_auto(
    &mut self,
    width: u32,
    height: u32,
    palette_size: usize
) -> &mut Self
[src]

Calculate and set the dithering level automatically based on image size and palette size.

Dithering level must be greater than 0.

pub fn palette(&mut self, palette: Vec<T>) -> Result<&mut Self, QuantError>[src]

Supply the palette colors to use for dithering. Length must be at least two.

pub fn verify_parameters(&self) -> Result<(), QuantError>[src]

Returns an error if any of the parameters are incorrectly set.

Trait Implementations

impl<T: Clone + SpatialQuant> Clone for Params<T>[src]

impl<T: Debug + SpatialQuant> Debug for Params<T>[src]

impl<T: SpatialQuant> Default for Params<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Params<T> where
    T: RefUnwindSafe

impl<T> Send for Params<T> where
    T: Send

impl<T> Sync for Params<T> where
    T: Sync

impl<T> Unpin for Params<T> where
    T: Unpin

impl<T> UnwindSafe for Params<T> where
    T: UnwindSafe

Blanket Implementations

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
    T: Component + Float,
    D: AdaptFrom<S, Swp, Dwp, T>,
    Swp: WhitePoint,
    Dwp: WhitePoint
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> ConvertInto<U> for T where
    U: ConvertFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.