#[repr(C)]
pub struct State { pub decoder: DecoderSettings, pub encoder: EncoderSettings, pub info_raw: ColorMode, pub info_png: Info, pub error: ErrorCode, }
Expand description

The settings, state and information for extended encoding and decoding

Fields

decoder: DecoderSettingsencoder: EncoderSettingsinfo_raw: ColorMode

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

info_png: Info

info of the PNG image obtained after decoding

error: ErrorCode

Implementations

👎 Deprecated:

Use Decoder or Encoder type instead

👎 Deprecated:

Use Encoder type instead of State

See `Encoder’

👎 Deprecated:

Use Encoder type instead of State

See `Encoder’

whether to convert the PNG to the color type you want. Default: yes

if false but remember_unknown_chunks is true, they’re stored in the unknown chunks.

store all bytes from unknown chunks in the Info (off by default, useful for a png editor)

Decompress ICC profile from iCCP chunk. Only available if remember_unknown_chunks was set.

👎 Deprecated:

Use Decoder type instead of State

Load PNG from buffer using State’s settings


state.info_raw_mut().colortype = ColorType::RGBA;
match state.decode(&slice) {
    Ok(Image::RGBA(with_alpha)) => do_stuff(with_alpha),
    _ => panic!("¯\\_(ツ)_/¯")
}
👎 Deprecated:

Use Decoder type instead of State

👎 Deprecated:

Use Decoder type instead of State

Updates info_png. Returns (width, height)

👎 Deprecated:

Use Encoder type instead of State

👎 Deprecated:

Use Encoder type instead of State

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.