#[non_exhaustive]
#[repr(u32)]
pub enum Format {
Show 108 variants Argb8888 = 0, Xrgb8888 = 1, C8 = 538_982_467, Rgb332 = 943_867_730, Bgr233 = 944_916_290, Xrgb4444 = 842_093_144, Xbgr4444 = 842_089_048, Rgbx4444 = 842_094_674, Bgrx4444 = 842_094_658, Argb4444 = 842_093_121, Abgr4444 = 842_089_025, Rgba4444 = 842_088_786, Bgra4444 = 842_088_770, Xrgb1555 = 892_424_792, Xbgr1555 = 892_420_696, Rgbx5551 = 892_426_322, Bgrx5551 = 892_426_306, Argb1555 = 892_424_769, Abgr1555 = 892_420_673, Rgba5551 = 892_420_434, Bgra5551 = 892_420_418, Rgb565 = 909_199_186, Bgr565 = 909_199_170, Rgb888 = 875_710_290, Bgr888 = 875_710_274, Xbgr8888 = 875_709_016, Rgbx8888 = 875_714_642, Bgrx8888 = 875_714_626, Abgr8888 = 875_708_993, Rgba8888 = 875_708_754, Bgra8888 = 875_708_738, Xrgb2101010 = 808_669_784, Xbgr2101010 = 808_665_688, Rgbx1010102 = 808_671_314, Bgrx1010102 = 808_671_298, Argb2101010 = 808_669_761, Abgr2101010 = 808_665_665, Rgba1010102 = 808_665_426, Bgra1010102 = 808_665_410, Yuyv = 1_448_695_129, Yvyu = 1_431_918_169, Uyvy = 1_498_831_189, Vyuy = 1_498_765_654, Ayuv = 1_448_433_985, Nv12 = 842_094_158, Nv21 = 825_382_478, Nv16 = 909_203_022, Nv61 = 825_644_622, Yuv410 = 961_959_257, Yvu410 = 961_893_977, Yuv411 = 825_316_697, Yvu411 = 825_316_953, Yuv420 = 842_093_913, Yvu420 = 842_094_169, Yuv422 = 909_202_777, Yvu422 = 909_203_033, Yuv444 = 875_713_881, Yvu444 = 875_714_137, R8 = 538_982_482, R16 = 540_422_482, Rg88 = 943_212_370, Gr88 = 943_215_175, Rg1616 = 842_221_394, Gr1616 = 842_224_199, Xrgb16161616f = 1_211_388_504, Xbgr16161616f = 1_211_384_408, Argb16161616f = 1_211_388_481, Abgr16161616f = 1_211_384_385, Xyuv8888 = 1_448_434_008, Vuy888 = 875_713_878, Vuy101010 = 808_670_550, Y210 = 808_530_521, Y212 = 842_084_953, Y216 = 909_193_817, Y410 = 808_531_033, Y412 = 842_085_465, Y416 = 909_194_329, Xvyu2101010 = 808_670_808, Xvyu1216161616 = 909_334_104, Xvyu16161616 = 942_954_072, Y0l0 = 810_299_481, X0l0 = 810_299_480, Y0l2 = 843_853_913, X0l2 = 843_853_912, Yuv4208bit = 942_691_673, Yuv42010bit = 808_539_481, Xrgb8888A8 = 943_805_016, Xbgr8888A8 = 943_800_920, Rgbx8888A8 = 943_806_546, Bgrx8888A8 = 943_806_530, Rgb888A8 = 943_798_354, Bgr888A8 = 943_798_338, Rgb565A8 = 943_797_586, Bgr565A8 = 943_797_570, Nv24 = 875_714_126, Nv42 = 842_290_766, P210 = 808_530_512, P010 = 808_530_000, P012 = 842_084_432, P016 = 909_193_296, Axbxgxrx106106106106 = 808_534_593, Nv15 = 892_425_806, Q410 = 808_531_025, Q401 = 825_242_705, Xrgb16161616 = 942_953_048, Xbgr16161616 = 942_948_952, Argb16161616 = 942_953_025, Abgr16161616 = 942_948_929,
}
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.

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

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

Argb8888 = 0

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

§

Xrgb8888 = 1

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

§

C8 = 538_982_467

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

§

Rgb332 = 943_867_730

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

§

Bgr233 = 944_916_290

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

§

Xrgb4444 = 842_093_144

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

§

Xbgr4444 = 842_089_048

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

§

Rgbx4444 = 842_094_674

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

§

Bgrx4444 = 842_094_658

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

§

Argb4444 = 842_093_121

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

§

Abgr4444 = 842_089_025

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

§

Rgba4444 = 842_088_786

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

§

Bgra4444 = 842_088_770

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

§

Xrgb1555 = 892_424_792

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

§

Xbgr1555 = 892_420_696

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

§

Rgbx5551 = 892_426_322

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

§

Bgrx5551 = 892_426_306

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

§

Argb1555 = 892_424_769

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

§

Abgr1555 = 892_420_673

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

§

Rgba5551 = 892_420_434

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

§

Bgra5551 = 892_420_418

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

§

Rgb565 = 909_199_186

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

§

Bgr565 = 909_199_170

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

§

Rgb888 = 875_710_290

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

§

Bgr888 = 875_710_274

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

§

Xbgr8888 = 875_709_016

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

§

Rgbx8888 = 875_714_642

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

§

Bgrx8888 = 875_714_626

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

§

Abgr8888 = 875_708_993

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

§

Rgba8888 = 875_708_754

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

§

Bgra8888 = 875_708_738

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

§

Xrgb2101010 = 808_669_784

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

§

Xbgr2101010 = 808_665_688

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

§

Rgbx1010102 = 808_671_314

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

§

Bgrx1010102 = 808_671_298

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

§

Argb2101010 = 808_669_761

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

§

Abgr2101010 = 808_665_665

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

§

Rgba1010102 = 808_665_426

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

§

Bgra1010102 = 808_665_410

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

§

Yuyv = 1_448_695_129

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

§

Yvyu = 1_431_918_169

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

§

Uyvy = 1_498_831_189

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

§

Vyuy = 1_498_765_654

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

§

Ayuv = 1_448_433_985

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

§

Nv12 = 842_094_158

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

§

Nv21 = 825_382_478

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

§

Nv16 = 909_203_022

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

§

Nv61 = 825_644_622

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

§

Yuv410 = 961_959_257

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

§

Yvu410 = 961_893_977

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

§

Yuv411 = 825_316_697

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

§

Yvu411 = 825_316_953

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

§

Yuv420 = 842_093_913

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

§

Yvu420 = 842_094_169

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

§

Yuv422 = 909_202_777

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

§

Yvu422 = 909_203_033

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

§

Yuv444 = 875_713_881

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

§

Yvu444 = 875_714_137

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

§

R8 = 538_982_482

[7:0] R

§

R16 = 540_422_482

[15:0] R little endian

§

Rg88 = 943_212_370

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

§

Gr88 = 943_215_175

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

§

Rg1616 = 842_221_394

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

§

Gr1616 = 842_224_199

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

§

Xrgb16161616f = 1_211_388_504

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

§

Xbgr16161616f = 1_211_384_408

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

§

Argb16161616f = 1_211_388_481

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

§

Abgr16161616f = 1_211_384_385

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

§

Xyuv8888 = 1_448_434_008

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

§

Vuy888 = 875_713_878

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

§

Vuy101010 = 808_670_550

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

§

Y210 = 808_530_521

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

§

Y212 = 842_084_953

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

§

Y216 = 909_193_817

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

§

Y410 = 808_531_033

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

§

Y412 = 842_085_465

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

§

Y416 = 909_194_329

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

§

Xvyu2101010 = 808_670_808

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

§

Xvyu1216161616 = 909_334_104

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

§

Xvyu16161616 = 942_954_072

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

§

Y0l0 = 810_299_481

[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

§

X0l0 = 810_299_480

[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

§

Y0l2 = 843_853_913

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

§

X0l2 = 843_853_912

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

§

Yuv4208bit = 942_691_673

§

Yuv42010bit = 808_539_481

§

Xrgb8888A8 = 943_805_016

§

Xbgr8888A8 = 943_800_920

§

Rgbx8888A8 = 943_806_546

§

Bgrx8888A8 = 943_806_530

§

Rgb888A8 = 943_798_354

§

Bgr888A8 = 943_798_338

§

Rgb565A8 = 943_797_586

§

Bgr565A8 = 943_797_570

§

Nv24 = 875_714_126

non-subsampled Cr:Cb plane

§

Nv42 = 842_290_766

non-subsampled Cb:Cr plane

§

P210 = 808_530_512

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

§

P010 = 808_530_000

2x2 subsampled Cr:Cb plane 10 bits per channel

§

P012 = 842_084_432

2x2 subsampled Cr:Cb plane 12 bits per channel

§

P016 = 909_193_296

2x2 subsampled Cr:Cb plane 16 bits per channel

§

Axbxgxrx106106106106 = 808_534_593

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

§

Nv15 = 892_425_806

2x2 subsampled Cr:Cb plane

§

Q410 = 808_531_025

§

Q401 = 825_242_705

§

Xrgb16161616 = 942_953_048

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

§

Xbgr16161616 = 942_948_952

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

§

Argb16161616 = 942_953_025

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

§

Abgr16161616 = 942_948_929

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

Trait Implementations§

source§

impl Clone for Format

source§

fn clone(&self) -> Format

Returns a copy 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 + PartialOrd,

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

impl PartialEq for Format

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl TryFrom<u32> for Format

§

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 StructuralEq 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> Downcast for T
where T: Any,

source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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,

§

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

§

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

§

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.