Struct imagequant::Image
[−]
[src]
pub struct Image<'a> { /* fields omitted */ }
Describes image dimensions for the library.
Methods
impl<'a> Image<'a>
[src]
fn new<PixelType: Copy>(
attr: &Attributes,
bitmap: &'a [PixelType],
width: usize,
height: usize,
gamma: f64
) -> Result<Self, liq_error>
[src]
attr: &Attributes,
bitmap: &'a [PixelType],
width: usize,
height: usize,
gamma: f64
) -> Result<Self, liq_error>
Describe dimensions of a slice of RGBA pixels.
bitmap
must be either &[u8]
or a slice with one element per pixel (&[RGBA]
).
Use 0.
for gamma if the image is sRGB (most images are).
fn new_stride<PixelType: Copy>(
attr: &Attributes,
bitmap: &'a [PixelType],
width: usize,
height: usize,
stride: usize,
gamma: f64
) -> Result<Self, liq_error>
[src]
attr: &Attributes,
bitmap: &'a [PixelType],
width: usize,
height: usize,
stride: usize,
gamma: f64
) -> Result<Self, liq_error>
Stride is in pixels. Allows defining regions of larger images or images with padding without copying.
fn width(&self) -> usize
[src]
fn height(&self) -> usize
[src]
fn add_fixed_color(&mut self, color: liq_color) -> liq_error
[src]
Reserves a color in the output palette created from this image. It behaves as if the given color was used in the image and was very important.
RGB values of liq_color are assumed to have the same gamma as the image.
It must be called before the image is quantized.
Returns error if more than 256 colors are added. If image is quantized to fewer colors than the number of fixed colors added, then excess fixed colors will be ignored.
fn set_background<'own, 'bg: 'own>(
&'own mut self,
background: Image<'bg>
) -> Result<(), liq_error>
[src]
&'own mut self,
background: Image<'bg>
) -> Result<(), liq_error>
Remap pixels assuming they will be displayed on this background.
Pixels that match the background color will be made transparent if there's a fully transparent color available in the palette.
The background image's pixels must outlive this image