Struct lodepng::ffi::Info

source ·
#[repr(C)]
pub struct Info { pub interlace_method: u8, pub color: ColorMode, pub background_defined: bool, pub background_r: u16, pub background_g: u16, pub background_b: u16, pub time_defined: bool, pub time: Time, pub phys_defined: bool, pub phys_x: c_uint, pub phys_y: c_uint, pub phys_unit: u8, /* private fields */ }
Expand description

Information about the PNG image, except pixels, width and height

Fields§

§interlace_method: u8

interlace method of the original file

§color: ColorMode

color type and bits, palette and transparency of the PNG file

§background_defined: bool

suggested background color chunk (bKGD) This color uses the same color mode as the PNG (except alpha channel), which can be 1-bit to 16-bit.

For greyscale PNGs, r, g and b will all 3 be set to the same. When encoding the encoder writes the red one. For palette PNGs: When decoding, the RGB value will be stored, not a palette index. But when encoding, specify the index of the palette in background_r, the other two are then ignored.

The decoder does not use this background color to edit the color of pixels.

§background_r: u16

red component of suggested background color

§background_g: u16

green component of suggested background color

§background_b: u16

blue component of suggested background color

§time_defined: bool

set to 1 to make the encoder generate a tIME chunk

§time: Time

time chunk (tIME)

§phys_defined: bool

if 0, there is no pHYs chunk and the values below are undefined, if 1 else there is one

§phys_x: c_uint

pixels per unit in x direction

§phys_y: c_uint

pixels per unit in y direction

§phys_unit: u8

may be 0 (unknown unit) or 1 (metre)

Implementations§

source§

impl Info

source

pub fn new() -> Self

source

pub fn text_keys(&self) -> TextKeysIter<'_>

source

pub fn text_keys_cstr(&self) -> TextKeysIter<'_>

👎Deprecated: use text_keys
source

pub fn itext_keys(&self) -> ITextKeysIter<'_>

source

pub fn clear_text(&mut self)

use this to clear the texts again after you filled them in

source

pub fn add_text(&mut self, key: &str, str: &str) -> Result<(), Error>

push back both texts at once

source

pub fn clear_itext(&mut self)

use this to clear the itexts again after you filled them in

source

pub fn add_itext( &mut self, key: &str, langtag: &str, transkey: &str, text: &str ) -> Result<(), Error>

push back the 4 texts of 1 chunk at once

source

pub fn append_chunk( &mut self, position: ChunkPosition, chunk: ChunkRef<'_> ) -> Result<(), Error>

Add literal PNG-data chunk unmodified to the unknown chunks

source

pub fn create_chunk<C: AsRef<[u8]>>( &mut self, position: ChunkPosition, chtype: C, data: &[u8] ) -> Result<(), Error>

Add custom chunk data to the file (if writing one)

source

pub fn get<NameBytes: AsRef<[u8]>>( &self, index: NameBytes ) -> Option<ChunkRef<'_>>

Uses linear search to find a given chunk. You can use b"PLTE" syntax.

source

pub fn unknown_chunks(&self, position: ChunkPosition) -> ChunksIterFragile<'_>

👎Deprecated: use try_unknown_chunks
source

pub fn try_unknown_chunks(&self, position: ChunkPosition) -> ChunksIter<'_>

Iterate over chunks that aren’t part of image data. Only available if remember_unknown_chunks was set.

Trait Implementations§

source§

impl Clone for Info

source§

fn clone(&self) -> Info

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Info

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Info

source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl RefUnwindSafe for Info

§

impl Send for Info

§

impl Sync for Info

§

impl Unpin for Info

§

impl UnwindSafe for Info

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.