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
impl PixelFormat
Sourcepub fn bytes_per_pixel(&self) -> usize
pub fn bytes_per_pixel(&self) -> usize
Number of bytes per pixel.
Sourcepub fn from_wl_format(code: u32) -> Option<Self>
pub fn from_wl_format(code: u32) -> Option<Self>
Convert a Wayland wl_shm format code to our enum.
Sourcepub fn to_wl_format(self) -> u32
pub fn to_wl_format(self) -> u32
Convert our format to the Wayland wl_shm format code.
Trait Implementations§
Source§impl Clone for PixelFormat
impl Clone for PixelFormat
Source§fn clone(&self) -> PixelFormat
fn clone(&self) -> PixelFormat
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PixelFormat
impl Debug for PixelFormat
Source§impl PartialEq for PixelFormat
impl PartialEq for PixelFormat
impl Copy for PixelFormat
impl Eq for PixelFormat
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 Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)