Struct lodepng::ffi::ColorMode [−][src]
#[repr(C)]pub struct ColorMode { pub colortype: ColorType, // some fields omitted }
Color mode of an image. Contains all information required to decode the pixel bits to RGBA colors. This information is the same as used in the PNG file format, and is used both for PNG and raw image data in LodePNG.
Fields
colortype: ColorType
color type, see PNG standard
Methods
impl ColorMode
[src]
impl ColorMode
pub fn new() -> Self
[src]
pub fn new() -> Self
pub fn colortype(&self) -> ColorType
[src]
pub fn colortype(&self) -> ColorType
pub fn bitdepth(&self) -> u32
[src]
pub fn bitdepth(&self) -> u32
pub fn set_bitdepth(&mut self, d: u32)
[src]
pub fn set_bitdepth(&mut self, d: u32)
pub fn palette_clear(&mut self)
[src]
pub fn palette_clear(&mut self)
pub fn palette_add(&mut self, p: RGBA) -> Result<(), Error>
[src]
pub fn palette_add(&mut self, p: RGBA) -> Result<(), Error>
add 1 color to the palette
pub fn palette(&self) -> &[RGBA]
[src]
pub fn palette(&self) -> &[RGBA]
pub fn palette_mut(&mut self) -> &mut [RGBA]
[src]
pub fn palette_mut(&mut self) -> &mut [RGBA]
pub fn bpp(&self) -> u32
[src]
pub fn bpp(&self) -> u32
get the total amount of bits per pixel, based on colortype and bitdepth in the struct
pub fn channels(&self) -> u8
[src]
pub fn channels(&self) -> u8
get the amount of color channels used, based on colortype in the struct. If a palette is used, it counts as 1 channel.
pub fn is_greyscale_type(&self) -> bool
[src]
pub fn is_greyscale_type(&self) -> bool
is it a greyscale type? (only colortype 0 or 4)
pub fn is_alpha_type(&self) -> bool
[src]
pub fn is_alpha_type(&self) -> bool
has it got an alpha channel? (only colortype 2 or 6)
pub fn is_palette_type(&self) -> bool
[src]
pub fn is_palette_type(&self) -> bool
has it got a palette? (only colortype 3)
pub fn has_palette_alpha(&self) -> bool
[src]
pub fn has_palette_alpha(&self) -> bool
only returns true if there is a palette and there is a value in the palette with alpha < 255. Loops through the palette to check this.
pub fn can_have_alpha(&self) -> bool
[src]
pub fn can_have_alpha(&self) -> bool
Check if the given color info indicates the possibility of having non-opaque pixels in the PNG image. Returns true if the image can have translucent or invisible pixels (it still be opaque if it doesn't use such pixels). Returns false if the image can only have opaque pixels. In detail, it returns true only if it's a color type with alpha, or has a palette with non-opaque values, or if "key_defined" is true.
pub fn raw_size(&self, w: u32, h: u32) -> usize
[src]
pub fn raw_size(&self, w: u32, h: u32) -> usize
Returns the byte size of a raw image buffer with given width, height and color mode
Trait Implementations
impl Debug for ColorMode
[src]
impl Debug for ColorMode
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Drop for ColorMode
[src]
impl Drop for ColorMode
impl Clone for ColorMode
[src]
impl Clone for ColorMode
fn clone(&self) -> Self
[src]
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Default for ColorMode
[src]
impl Default for ColorMode