Enum PixelFormat

Source
#[repr(i32)]
pub enum PixelFormat {
Show 20 variants Rgb555 = 1, Rgb565 = 2, Rgb888 = 3, Bgr555 = 4, Bgr565 = 5, Bgr888 = 6, Argb8888 = 16, Rgba8888 = 17, Abgr8888 = 18, Bgra8888 = 19, G1 = 64, G2 = 65, G4 = 66, G8 = 67, Ag88 = 83, Ga88 = 99, Pal1 = 128, Pal2 = 129, Pal4 = 130, Pal8 = 131,
}
Expand description

Represents pixel format modes (bpp = bits per pixel).

Variants§

§

Rgb555 = 1

15bpp

§

Rgb565 = 2

16bpp

§

Rgb888 = 3

24bpp

§

Bgr555 = 4

15bpp

§

Bgr565 = 5

16bpp

§

Bgr888 = 6

24bpp

§

Argb8888 = 16

32bpp

§

Rgba8888 = 17

32bpp

§

Abgr8888 = 18

32bpp

§

Bgra8888 = 19

32bpp

§

G1 = 64

1bpp grayscale

§

G2 = 65

2bpp grayscale

§

G4 = 66

4bpp grayscale

§

G8 = 67

8bpp grayscale

§

Ag88 = 83

16bpp grayscale + alpha

§

Ga88 = 99

16bpp grayscale + alpha

§

Pal1 = 128

1bpp palette

§

Pal2 = 129

2bpp palette

§

Pal4 = 130

4bpp palette

§

Pal8 = 131

8bpp palette

Implementations§

Source§

impl PixelFormat

Source

pub const fn new() -> Self

Creates a new PixelFormat.

Source

pub fn compute_depth(&self) -> usize

Compute the pixel depth for the PixelFormat.

Source

pub fn rgb(&self, data: &[u8], depth: usize) -> Result<Rgb>

Gets the Rgb values at the given depth from the provide data.

Source

pub fn expand_rgb( &self, dst: &mut [u8], src: &[u8], width: usize, height: usize, depth: usize, ) -> Result<()>

Expands the PixelFormat RGB data.

Source

pub fn expand_palette( &self, dst: &mut [u8], src: &[u8], width: usize, height: usize, ) -> Result<()>

Expands the Sixel color palette.

Source

pub fn normalize( &mut self, dst: &mut [u8], src: &[u8], width: usize, height: usize, ) -> Result<()>

Normalizes the PixelFormat.

Trait Implementations§

Source§

impl Clone for PixelFormat

Source§

fn clone(&self) -> PixelFormat

Returns a duplicate 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 PixelFormat

Source§

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

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

impl Default for PixelFormat

Source§

fn default() -> PixelFormat

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

impl Display for PixelFormat

Source§

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

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

impl From<&PixelFormat> for &'static str

Source§

fn from(val: &PixelFormat) -> Self

Converts to this type from the input type.
Source§

impl From<PixelFormat> for &'static str

Source§

fn from(val: PixelFormat) -> Self

Converts to this type from the input type.
Source§

impl From<PixelFormat> for i32

Source§

fn from(val: PixelFormat) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for PixelFormat

Source§

fn from(val: i32) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for PixelFormat

Source§

fn eq(&self, other: &PixelFormat) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for PixelFormat

Source§

impl StructuralPartialEq for PixelFormat

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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

Source§

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.