GitHub project page

Struct lodepng::State [] [src]

pub struct State {
    // some fields omitted
}

Methods

impl State

fn new() -> State

fn info_raw(&mut self) -> &mut ColorMode

fn info_png(&mut self) -> &mut Info

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

Load PNG from buffer using State's settings


 state.info_raw().colortype = LCT_RGBA;
 match state.decode(&slice) {
     Ok(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, P: AsRef<Path>>(&mut self, filepath: P, 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)