Skip to main content

Format

Struct Format 

Source
#[non_exhaustive]
pub struct Format(pub u32);
Expand description

pixel formats

This describes the memory layout of an individual pixel.

All renderers should support argb8888 and xrgb8888 but any other formats are optional and may not be supported by the particular renderer in use.

The drm format codes match the macros defined in drm_fourcc.h, except argb8888 and xrgb8888. The formats actually supported by the compositor will be reported by the format event. See drm_fourcc.h for more detailed format descriptions.

For all wl_shm formats and unless specified in another protocol extension, pre-multiplied alpha is used for pixel values.

Tuple Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§0: u32

Implementations§

Source§

impl Format

Source

pub const Argb8888: Self

32-bit ARGB format, [31:0] A:R:G:B 8:8:8:8 little endian

Source

pub const Xrgb8888: Self

32-bit RGB format, [31:0] x:R:G:B 8:8:8:8 little endian

Source

pub const C8: Self

8-bit color index format, [7:0] C

Source

pub const Rgb332: Self

8-bit RGB format, [7:0] R:G:B 3:3:2

Source

pub const Bgr233: Self

8-bit BGR format, [7:0] B:G:R 2:3:3

Source

pub const Xrgb4444: Self

16-bit xRGB format, [15:0] x:R:G:B 4:4:4:4 little endian

Source

pub const Xbgr4444: Self

16-bit xBGR format, [15:0] x:B:G:R 4:4:4:4 little endian

Source

pub const Rgbx4444: Self

16-bit RGBx format, [15:0] R:G:B:x 4:4:4:4 little endian

Source

pub const Bgrx4444: Self

16-bit BGRx format, [15:0] B:G:R:x 4:4:4:4 little endian

Source

pub const Argb4444: Self

16-bit ARGB format, [15:0] A:R:G:B 4:4:4:4 little endian

Source

pub const Abgr4444: Self

16-bit ABGR format, [15:0] A:B:G:R 4:4:4:4 little endian

Source

pub const Rgba4444: Self

16-bit RBGA format, [15:0] R:G:B:A 4:4:4:4 little endian

Source

pub const Bgra4444: Self

16-bit BGRA format, [15:0] B:G:R:A 4:4:4:4 little endian

Source

pub const Xrgb1555: Self

16-bit xRGB format, [15:0] x:R:G:B 1:5:5:5 little endian

Source

pub const Xbgr1555: Self

16-bit xBGR 1555 format, [15:0] x:B:G:R 1:5:5:5 little endian

Source

pub const Rgbx5551: Self

16-bit RGBx 5551 format, [15:0] R:G:B:x 5:5:5:1 little endian

Source

pub const Bgrx5551: Self

16-bit BGRx 5551 format, [15:0] B:G:R:x 5:5:5:1 little endian

Source

pub const Argb1555: Self

16-bit ARGB 1555 format, [15:0] A:R:G:B 1:5:5:5 little endian

Source

pub const Abgr1555: Self

16-bit ABGR 1555 format, [15:0] A:B:G:R 1:5:5:5 little endian

Source

pub const Rgba5551: Self

16-bit RGBA 5551 format, [15:0] R:G:B:A 5:5:5:1 little endian

Source

pub const Bgra5551: Self

16-bit BGRA 5551 format, [15:0] B:G:R:A 5:5:5:1 little endian

Source

pub const Rgb565: Self

16-bit RGB 565 format, [15:0] R:G:B 5:6:5 little endian

Source

pub const Bgr565: Self

16-bit BGR 565 format, [15:0] B:G:R 5:6:5 little endian

Source

pub const Rgb888: Self

24-bit RGB format, [23:0] R:G:B little endian

Source

pub const Bgr888: Self

24-bit BGR format, [23:0] B:G:R little endian

Source

pub const Xbgr8888: Self

32-bit xBGR format, [31:0] x:B:G:R 8:8:8:8 little endian

Source

pub const Rgbx8888: Self

32-bit RGBx format, [31:0] R:G:B:x 8:8:8:8 little endian

Source

pub const Bgrx8888: Self

32-bit BGRx format, [31:0] B:G:R:x 8:8:8:8 little endian

Source

pub const Abgr8888: Self

32-bit ABGR format, [31:0] A:B:G:R 8:8:8:8 little endian

Source

pub const Rgba8888: Self

32-bit RGBA format, [31:0] R:G:B:A 8:8:8:8 little endian

Source

pub const Bgra8888: Self

32-bit BGRA format, [31:0] B:G:R:A 8:8:8:8 little endian

Source

pub const Xrgb2101010: Self

32-bit xRGB format, [31:0] x:R:G:B 2:10:10:10 little endian

Source

pub const Xbgr2101010: Self

32-bit xBGR format, [31:0] x:B:G:R 2:10:10:10 little endian

Source

pub const Rgbx1010102: Self

32-bit RGBx format, [31:0] R:G:B:x 10:10:10:2 little endian

Source

pub const Bgrx1010102: Self

32-bit BGRx format, [31:0] B:G:R:x 10:10:10:2 little endian

Source

pub const Argb2101010: Self

32-bit ARGB format, [31:0] A:R:G:B 2:10:10:10 little endian

Source

pub const Abgr2101010: Self

32-bit ABGR format, [31:0] A:B:G:R 2:10:10:10 little endian

Source

pub const Rgba1010102: Self

32-bit RGBA format, [31:0] R:G:B:A 10:10:10:2 little endian

Source

pub const Bgra1010102: Self

32-bit BGRA format, [31:0] B:G:R:A 10:10:10:2 little endian

Source

pub const Yuyv: Self

packed YCbCr format, [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian

Source

pub const Yvyu: Self

packed YCbCr format, [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian

Source

pub const Uyvy: Self

packed YCbCr format, [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian

Source

pub const Vyuy: Self

packed YCbCr format, [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian

Source

pub const Ayuv: Self

packed AYCbCr format, [31:0] A:Y:Cb:Cr 8:8:8:8 little endian

Source

pub const Nv12: Self

2 plane YCbCr Cr:Cb format, 2x2 subsampled Cr:Cb plane

Source

pub const Nv21: Self

2 plane YCbCr Cb:Cr format, 2x2 subsampled Cb:Cr plane

Source

pub const Nv16: Self

2 plane YCbCr Cr:Cb format, 2x1 subsampled Cr:Cb plane

Source

pub const Nv61: Self

2 plane YCbCr Cb:Cr format, 2x1 subsampled Cb:Cr plane

Source

pub const Yuv410: Self

3 plane YCbCr format, 4x4 subsampled Cb (1) and Cr (2) planes

Source

pub const Yvu410: Self

3 plane YCbCr format, 4x4 subsampled Cr (1) and Cb (2) planes

Source

pub const Yuv411: Self

3 plane YCbCr format, 4x1 subsampled Cb (1) and Cr (2) planes

Source

pub const Yvu411: Self

3 plane YCbCr format, 4x1 subsampled Cr (1) and Cb (2) planes

Source

pub const Yuv420: Self

3 plane YCbCr format, 2x2 subsampled Cb (1) and Cr (2) planes

Source

pub const Yvu420: Self

3 plane YCbCr format, 2x2 subsampled Cr (1) and Cb (2) planes

Source

pub const Yuv422: Self

3 plane YCbCr format, 2x1 subsampled Cb (1) and Cr (2) planes

Source

pub const Yvu422: Self

3 plane YCbCr format, 2x1 subsampled Cr (1) and Cb (2) planes

Source

pub const Yuv444: Self

3 plane YCbCr format, non-subsampled Cb (1) and Cr (2) planes

Source

pub const Yvu444: Self

3 plane YCbCr format, non-subsampled Cr (1) and Cb (2) planes

Source

pub const R8: Self

[7:0] R

Source

pub const R16: Self

[15:0] R little endian

Source

pub const Rg88: Self

[15:0] R:G 8:8 little endian

Source

pub const Gr88: Self

[15:0] G:R 8:8 little endian

Source

pub const Rg1616: Self

[31:0] R:G 16:16 little endian

Source

pub const Gr1616: Self

[31:0] G:R 16:16 little endian

Source

pub const Xrgb16161616f: Self

[63:0] x:R:G:B 16:16:16:16 little endian

Source

pub const Xbgr16161616f: Self

[63:0] x:B:G:R 16:16:16:16 little endian

Source

pub const Argb16161616f: Self

[63:0] A:R:G:B 16:16:16:16 little endian

Source

pub const Abgr16161616f: Self

[63:0] A:B:G:R 16:16:16:16 little endian

Source

pub const Xyuv8888: Self

[31:0] X:Y:Cb:Cr 8:8:8:8 little endian

Source

pub const Vuy888: Self

[23:0] Cr:Cb:Y 8:8:8 little endian

Source

pub const Vuy101010: Self

Y followed by U then V, 10:10:10. Non-linear modifier only

Source

pub const Y210: Self

[63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 10:6:10:6:10:6:10:6 little endian per 2 Y pixels

Source

pub const Y212: Self

[63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 12:4:12:4:12:4:12:4 little endian per 2 Y pixels

Source

pub const Y216: Self

[63:0] Cr0:Y1:Cb0:Y0 16:16:16:16 little endian per 2 Y pixels

Source

pub const Y410: Self

[31:0] A:Cr:Y:Cb 2:10:10:10 little endian

Source

pub const Y412: Self

[63:0] A:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian

Source

pub const Y416: Self

[63:0] A:Cr:Y:Cb 16:16:16:16 little endian

Source

pub const Xvyu2101010: Self

[31:0] X:Cr:Y:Cb 2:10:10:10 little endian

Source

pub const Xvyu1216161616: Self

[63:0] X:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian

Source

pub const Xvyu16161616: Self

[63:0] X:Cr:Y:Cb 16:16:16:16 little endian

Source

pub const Y0l0: Self

[63:0] A3:A2:Y3:0:Cr0:0:Y2:0:A1:A0:Y1:0:Cb0:0:Y0:0 1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian

Source

pub const X0l0: Self

[63:0] X3:X2:Y3:0:Cr0:0:Y2:0:X1:X0:Y1:0:Cb0:0:Y0:0 1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian

Source

pub const Y0l2: Self

[63:0] A3:A2:Y3:Cr0:Y2:A1:A0:Y1:Cb0:Y0 1:1:10:10:10:1:1:10:10:10 little endian

Source

pub const X0l2: Self

[63:0] X3:X2:Y3:Cr0:Y2:X1:X0:Y1:Cb0:Y0 1:1:10:10:10:1:1:10:10:10 little endian

Source

pub const Yuv4208bit: Self

Source

pub const Yuv42010bit: Self

Source

pub const Xrgb8888A8: Self

Source

pub const Xbgr8888A8: Self

Source

pub const Rgbx8888A8: Self

Source

pub const Bgrx8888A8: Self

Source

pub const Rgb888A8: Self

Source

pub const Bgr888A8: Self

Source

pub const Rgb565A8: Self

Source

pub const Bgr565A8: Self

Source

pub const Nv24: Self

non-subsampled Cr:Cb plane

Source

pub const Nv42: Self

non-subsampled Cb:Cr plane

Source

pub const P210: Self

2x1 subsampled Cr:Cb plane, 10 bit per channel

Source

pub const P010: Self

2x2 subsampled Cr:Cb plane 10 bits per channel

Source

pub const P012: Self

2x2 subsampled Cr:Cb plane 12 bits per channel

Source

pub const P016: Self

2x2 subsampled Cr:Cb plane 16 bits per channel

Source

pub const Axbxgxrx106106106106: Self

[63:0] A:x:B:x:G:x:R:x 10:6:10:6:10:6:10:6 little endian

Source

pub const Nv15: Self

2x2 subsampled Cr:Cb plane

Source

pub const Q410: Self

Source

pub const Q401: Self

Source

pub const Xrgb16161616: Self

[63:0] x:R:G:B 16:16:16:16 little endian

Source

pub const Xbgr16161616: Self

[63:0] x:B:G:R 16:16:16:16 little endian

Source

pub const Argb16161616: Self

[63:0] A:R:G:B 16:16:16:16 little endian

Source

pub const Abgr16161616: Self

[63:0] A:B:G:R 16:16:16:16 little endian

Source

pub const C1: Self

[7:0] C0:C1:C2:C3:C4:C5:C6:C7 1:1:1:1:1:1:1:1 eight pixels/byte

Source

pub const C2: Self

[7:0] C0:C1:C2:C3 2:2:2:2 four pixels/byte

Source

pub const C4: Self

[7:0] C0:C1 4:4 two pixels/byte

Source

pub const D1: Self

[7:0] D0:D1:D2:D3:D4:D5:D6:D7 1:1:1:1:1:1:1:1 eight pixels/byte

Source

pub const D2: Self

[7:0] D0:D1:D2:D3 2:2:2:2 four pixels/byte

Source

pub const D4: Self

[7:0] D0:D1 4:4 two pixels/byte

Source

pub const D8: Self

[7:0] D

Source

pub const R1: Self

[7:0] R0:R1:R2:R3:R4:R5:R6:R7 1:1:1:1:1:1:1:1 eight pixels/byte

Source

pub const R2: Self

[7:0] R0:R1:R2:R3 2:2:2:2 four pixels/byte

Source

pub const R4: Self

[7:0] R0:R1 4:4 two pixels/byte

Source

pub const R10: Self

[15:0] x:R 6:10 little endian

Source

pub const R12: Self

[15:0] x:R 4:12 little endian

Source

pub const Avuy8888: Self

[31:0] A:Cr:Cb:Y 8:8:8:8 little endian

Source

pub const Xvuy8888: Self

[31:0] X:Cr:Cb:Y 8:8:8:8 little endian

Source

pub const P030: Self

2x2 subsampled Cr:Cb plane 10 bits per channel packed

Source

pub const Rgb161616: Self

[47:0] R:G:B 16:16:16 little endian

Source

pub const Bgr161616: Self

[47:0] B:G:R 16:16:16 little endian

Source

pub const R16f: Self

[15:0] R 16 little endian

Source

pub const Gr1616f: Self

[31:0] G:R 16:16 little endian

Source

pub const Bgr161616f: Self

[47:0] B:G:R 16:16:16 little endian

Source

pub const R32f: Self

[31:0] R 32 little endian

Source

pub const Gr3232f: Self

[63:0] R:G 32:32 little endian

Source

pub const Bgr323232f: Self

[95:0] R:G:B 32:32:32 little endian

Source

pub const Abgr32323232f: Self

[127:0] R:G:B:A 32:32:32:32 little endian

Source

pub const Nv20: Self

2x1 subsampled Cr:Cb plane

Source

pub const Nv30: Self

non-subsampled Cr:Cb plane

Source

pub const S010: Self

2x2 subsampled Cb (1) and Cr (2) planes 10 bits per channel

Source

pub const S210: Self

2x1 subsampled Cb (1) and Cr (2) planes 10 bits per channel

Source

pub const S410: Self

non-subsampled Cb (1) and Cr (2) planes 10 bits per channel

Source

pub const S012: Self

2x2 subsampled Cb (1) and Cr (2) planes 12 bits per channel

Source

pub const S212: Self

2x1 subsampled Cb (1) and Cr (2) planes 12 bits per channel

Source

pub const S412: Self

non-subsampled Cb (1) and Cr (2) planes 12 bits per channel

Source

pub const S016: Self

2x2 subsampled Cb (1) and Cr (2) planes 16 bits per channel

Source

pub const S216: Self

2x1 subsampled Cb (1) and Cr (2) planes 16 bits per channel

Source

pub const S416: Self

non-subsampled Cb (1) and Cr (2) planes 16 bits per channel

Trait Implementations§

Source§

impl Clone for Format

Source§

fn clone(&self) -> Format

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 Format

Source§

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

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

impl From<Format> for u32

Source§

fn from(val: Format) -> u32

Converts to this type from the input type.
Source§

impl Hash for Format

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Format

Source§

fn cmp(&self, other: &Format) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Format

Source§

fn eq(&self, other: &Format) -> 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 PartialOrd for Format

Source§

fn partial_cmp(&self, other: &Format) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl TryFrom<u32> for Format

Source§

type Error = ()

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

fn try_from(val: u32) -> Result<Format, ()>

Performs the conversion.
Source§

impl Copy for Format

Source§

impl Eq for Format

Source§

impl StructuralPartialEq for Format

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