⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

PixelFormat

Enum PixelFormat 

Source
pub enum PixelFormat {
    Rgb888,
    Bgr888,
    Rgba8888,
    Bgra8888,
    Xrgb8888,
    Argb8888,
    Rgb565,
    Bgrx8888,
    Gray8,
    Xbgr8888,
    Abgr8888,
}
Expand description

Canonical pixel format descriptor.

This is the single source of truth for pixel formats across all subsystems (drivers, video, graphics acceleration, Wayland buffers).

Variants§

§

Rgb888

24-bit: R(8) G(8) B(8), packed.

§

Bgr888

24-bit: B(8) G(8) R(8), packed.

§

Rgba8888

32-bit: R(8) G(8) B(8) A(8).

§

Bgra8888

32-bit: B(8) G(8) R(8) A(8).

§

Xrgb8888

32-bit: x(8) R(8) G(8) B(8), alpha ignored.

§

Argb8888

32-bit: A(8) R(8) G(8) B(8), premultiplied alpha.

§

Rgb565

16-bit: R(5) G(6) B(5).

§

Bgrx8888

32-bit: B(8) G(8) R(8) x(8), alpha ignored.

§

Gray8

8-bit grayscale.

§

Xbgr8888

32-bit: x(8) B(8) G(8) R(8), alpha ignored.

§

Abgr8888

32-bit: A(8) B(8) G(8) R(8).

Implementations§

Source§

impl PixelFormat

Source

pub fn bytes_per_pixel(&self) -> usize

Number of bytes per pixel.

Source

pub fn bpp(&self) -> u32

Bytes per pixel (alias for bytes_per_pixel, returns u32).

Source

pub fn has_alpha(&self) -> bool

Whether this format carries an alpha channel.

Source

pub fn from_wl_format(code: u32) -> Option<Self>

Convert a Wayland wl_shm format code to our enum.

Source

pub fn to_wl_format(self) -> u32

Convert our format to the Wayland wl_shm format code.

Trait Implementations§

Source§

impl Clone for PixelFormat

Source§

fn clone(&self) -> PixelFormat

Returns a duplicate of the value. Read more
1.0.0§

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

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 Eq for PixelFormat

Source§

impl StructuralPartialEq for PixelFormat

Auto Trait Implementations§

§

impl Freeze for PixelFormat

§

impl RefUnwindSafe for PixelFormat

§

impl Send for PixelFormat

§

impl Sync for PixelFormat

§

impl Unpin for PixelFormat

§

impl UnwindSafe for PixelFormat

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

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

§

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
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

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

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

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

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

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

Performs the conversion.