[][src]Struct imagequant::Histogram

pub struct Histogram<'a> { /* fields omitted */ }

Generate one shared palette for multiple images.

Implementations

impl<'a> Histogram<'a>[src]

pub fn new(attr: &'a Attributes) -> Self[src]

Creates histogram object that will be used to collect color statistics from multiple images.

All options should be set on attr before the histogram object is created. Options changed later may not have effect.

pub fn add_image(&mut self, image: &mut Image<'_>) -> liq_error[src]

"Learns" colors from the image, which will be later used to generate the palette.

Fixed colors added to the image are also added to the histogram. If total number of fixed colors exceeds 256, this function will fail with LIQ_BUFFER_TOO_SMALL.

pub fn add_colors(&mut self, colors: &[HistogramEntry], gamma: f64) -> liq_error[src]

Alternative to add_image(). Intead of counting colors in an image, it directly takes an array of colors and their counts.

This function is only useful if you already have a histogram of the image from another source.

pub fn quantize(&mut self) -> Result<QuantizationResult, liq_error>[src]

Generate palette for all images/colors added to the histogram.

Palette generated using this function won't be improved during remapping. If you're generating palette for only one image, it's better not to use the Histogram.

Trait Implementations

impl<'a> Drop for Histogram<'a>[src]

impl<'a> Send for Histogram<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Histogram<'a>[src]

impl<'a> !Sync for Histogram<'a>[src]

impl<'a> Unpin for Histogram<'a>[src]

impl<'a> UnwindSafe for Histogram<'a>[src]

Blanket Implementations

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> From<T> for T[src]

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

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.