Struct lodepng::State [] [src]

pub struct State {
    // some fields omitted
}

Methods

impl State
[src]

fn new() -> State

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

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

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

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
[src]

fn drop(&mut self)

A method called when the value goes out of scope. Read more

impl Clone for State
[src]

fn clone(&self) -> State

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more