Struct rscolorq::Params [−][src]
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]
&mut self,
width: u32,
height: u32,
palette_size: usize
) -> &mut Self
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,
T: RefUnwindSafe,
impl<T> Send for Params<T> where
T: Send,
T: Send,
impl<T> Sync for Params<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Params<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Params<T> where
T: UnwindSafe,
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]
T: Component + Float,
D: AdaptFrom<S, Swp, Dwp, T>,
Swp: WhitePoint,
Dwp: WhitePoint,
pub fn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
[src]
M: TransformMatrix<Swp, Dwp, T>,
pub fn adapt_into(self) -> D
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> ConvertInto<U> for T where
U: ConvertFrom<T>,
[src]
U: ConvertFrom<T>,
pub fn convert_into(self) -> U
[src]
pub fn convert_unclamped_into(self) -> U
[src]
pub fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,