GitHub project page

Struct lodepng::ffi::State [-]  [+] [src]

pub struct State {
    pub decoder: DecoderSettings,
    pub encoder: EncoderSettings,
    pub info_raw: ColorMode,
    pub info_png: Info,
    // some fields omitted
}

The settings, state and information for extended encoding and decoding

Fields

decoder
encoder
info_raw

specifies the format in which you would like to get the raw pixel buffer

info_png

info of the PNG image obtained after decoding

Methods

impl State

fn new() -> State

fn decode(&mut self, input: &[u8]) -> Result<Image, Error>

Load PNG from buffer using State's settings

self.info_raw.colortype = LCT_RGBA;
match try!(state.decode(slice)) {
    Image::RGBA(with_alpha) => do_stuff(with_alpha),
    _ => panic!("¯\\_(ツ)_/¯")
}

fn inspect(&mut self, input: &[u8]) -> Result<(usize, usize), Error>

Returns (width, height)

fn encode<PixelType>(&mut self, image: &[PixelType], w: usize, h: usize) -> Result<CVec<u8>, Error>

fn encode_file<PixelType>(&mut self, filepath: &Path, image: &[PixelType], w: usize, h: usize) -> Result<(), Error>

Trait Implementations

impl Drop for State

fn drop(&mut self)

impl Clone for State

fn clone(&self) -> State

fn clone_from(&mut self, source: &Self)