Struct lodepng::ffi::ColorProfile

source ·
#[repr(C)]
pub struct ColorProfile { pub colored: bool, pub key: bool, pub key_r: u16, pub key_g: u16, pub key_b: u16, pub alpha: bool, pub bits: u8, pub numcolors: u16, pub palette: [RGBA; 256], }
Expand description

Gives characteristics about the colors of the image, which helps decide which color model to use for encoding. Used internally by default if auto_convert is enabled. Public because it’s useful for custom algorithms.

Fields§

§colored: bool

not greyscale

§key: bool

image is not opaque and color key is possible instead of full alpha

§key_r: u16

key values, always as 16-bit, in 8-bit case the byte is duplicated, e.g. 65535 means 255

§key_g: u16§key_b: u16§alpha: bool

image is not opaque and alpha channel or alpha palette required

§bits: u8

amount of colors, up to 257. Not valid if bits == 16. bits per channel (not for palette). 1,2 or 4 for greyscale only. 16 if 16-bit per channel required.

§numcolors: u16§palette: [RGBA; 256]

Remembers up to the first 256 RGBA colors, in no particular order

Implementations§

source§

impl ColorProfile

source

pub fn new() -> Self

Trait Implementations§

source§

impl Debug for ColorProfile

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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, 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.