Enum piet_common::ImageFormat
source · #[non_exhaustive]
pub enum ImageFormat {
Grayscale,
Rgb,
RgbaSeparate,
RgbaPremul,
}
Expand description
The pixel format for bitmap images.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Grayscale
1 byte per pixel.
For example, a white pixel has value 0xff.
Rgb
3 bytes per pixel, in RGB order.
For example, a red pixel consists of three bytes [0xff, 0, 0]
independent of the system’s
endianness.
RgbaSeparate
4 bytes per pixel, in RGBA order, with separate alpha.
For example, a full-intensity red pixel with 50% transparency consists of four bytes
[0xff, 0, 0, 0x80]
independent of the system’s endianness.
RgbaPremul
4 bytes per pixel, in RGBA order, with premultiplied alpha.
For example, a full-intensity red pixel with 50% transparency consists of four bytes
[0x80, 0, 0, 0x80]
independent of the system’s endianness.
Implementations§
source§impl ImageFormat
impl ImageFormat
sourcepub fn bytes_per_pixel(self) -> usize
pub fn bytes_per_pixel(self) -> usize
The number of bytes required to represent a pixel in this format.
Trait Implementations§
source§impl Clone for ImageFormat
impl Clone for ImageFormat
source§fn clone(&self) -> ImageFormat
fn clone(&self) -> ImageFormat
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ImageFormat
impl Debug for ImageFormat
source§impl PartialEq<ImageFormat> for ImageFormat
impl PartialEq<ImageFormat> for ImageFormat
source§fn eq(&self, other: &ImageFormat) -> bool
fn eq(&self, other: &ImageFormat) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Copy for ImageFormat
impl Eq for ImageFormat
impl StructuralEq for ImageFormat
impl StructuralPartialEq for ImageFormat
Auto Trait Implementations§
impl RefUnwindSafe for ImageFormat
impl Send for ImageFormat
impl Sync for ImageFormat
impl Unpin for ImageFormat
impl UnwindSafe for ImageFormat
Blanket Implementations§
source§impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
source§fn round_into(self) -> U
fn round_into(self) -> U
Performs the conversion.