Enum Format

Source
#[non_exhaustive]
#[repr(u32)]
pub enum Format {
Show 123 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, C1 = 538_980_675, C2 = 538_980_931, C4 = 538_981_443, D1 = 538_980_676, D2 = 538_980_932, D4 = 538_981_444, D8 = 538_982_468, R1 = 538_980_690, R2 = 538_980_946, R4 = 538_981_458, R10 = 540_029_266, R12 = 540_160_338, Avuy8888 = 1_498_764_865, Xvuy8888 = 1_498_764_888, P030 = 808_661_072,
}
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

Since version 1.

§

Xrgb8888 = 1

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

Since version 1.

§

C8 = 538_982_467

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

Since version 1.

§

Rgb332 = 943_867_730

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

Since version 1.

§

Bgr233 = 944_916_290

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

Since version 1.

§

Xrgb4444 = 842_093_144

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

Since version 1.

§

Xbgr4444 = 842_089_048

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

Since version 1.

§

Rgbx4444 = 842_094_674

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

Since version 1.

§

Bgrx4444 = 842_094_658

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

Since version 1.

§

Argb4444 = 842_093_121

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

Since version 1.

§

Abgr4444 = 842_089_025

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

Since version 1.

§

Rgba4444 = 842_088_786

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

Since version 1.

§

Bgra4444 = 842_088_770

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

Since version 1.

§

Xrgb1555 = 892_424_792

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

Since version 1.

§

Xbgr1555 = 892_420_696

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

Since version 1.

§

Rgbx5551 = 892_426_322

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

Since version 1.

§

Bgrx5551 = 892_426_306

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

Since version 1.

§

Argb1555 = 892_424_769

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

Since version 1.

§

Abgr1555 = 892_420_673

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

Since version 1.

§

Rgba5551 = 892_420_434

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

Since version 1.

§

Bgra5551 = 892_420_418

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

Since version 1.

§

Rgb565 = 909_199_186

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

Since version 1.

§

Bgr565 = 909_199_170

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

Since version 1.

§

Rgb888 = 875_710_290

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

Since version 1.

§

Bgr888 = 875_710_274

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

Since version 1.

§

Xbgr8888 = 875_709_016

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

Since version 1.

§

Rgbx8888 = 875_714_642

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

Since version 1.

§

Bgrx8888 = 875_714_626

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

Since version 1.

§

Abgr8888 = 875_708_993

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

Since version 1.

§

Rgba8888 = 875_708_754

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

Since version 1.

§

Bgra8888 = 875_708_738

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

Since version 1.

§

Xrgb2101010 = 808_669_784

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

Since version 1.

§

Xbgr2101010 = 808_665_688

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

Since version 1.

§

Rgbx1010102 = 808_671_314

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

Since version 1.

§

Bgrx1010102 = 808_671_298

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

Since version 1.

§

Argb2101010 = 808_669_761

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

Since version 1.

§

Abgr2101010 = 808_665_665

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

Since version 1.

§

Rgba1010102 = 808_665_426

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

Since version 1.

§

Bgra1010102 = 808_665_410

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

Since version 1.

§

Yuyv = 1_448_695_129

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

Since version 1.

§

Yvyu = 1_431_918_169

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

Since version 1.

§

Uyvy = 1_498_831_189

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

Since version 1.

§

Vyuy = 1_498_765_654

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

Since version 1.

§

Ayuv = 1_448_433_985

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

Since version 1.

§

Nv12 = 842_094_158

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

Since version 1.

§

Nv21 = 825_382_478

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

Since version 1.

§

Nv16 = 909_203_022

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

Since version 1.

§

Nv61 = 825_644_622

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

Since version 1.

§

Yuv410 = 961_959_257

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

Since version 1.

§

Yvu410 = 961_893_977

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

Since version 1.

§

Yuv411 = 825_316_697

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

Since version 1.

§

Yvu411 = 825_316_953

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

Since version 1.

§

Yuv420 = 842_093_913

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

Since version 1.

§

Yvu420 = 842_094_169

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

Since version 1.

§

Yuv422 = 909_202_777

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

Since version 1.

§

Yvu422 = 909_203_033

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

Since version 1.

§

Yuv444 = 875_713_881

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

Since version 1.

§

Yvu444 = 875_714_137

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

Since version 1.

§

R8 = 538_982_482

[7:0] R

Since version 1.

§

R16 = 540_422_482

[15:0] R little endian

Since version 1.

§

Rg88 = 943_212_370

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

Since version 1.

§

Gr88 = 943_215_175

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

Since version 1.

§

Rg1616 = 842_221_394

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

Since version 1.

§

Gr1616 = 842_224_199

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

Since version 1.

§

Xrgb16161616f = 1_211_388_504

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

Since version 1.

§

Xbgr16161616f = 1_211_384_408

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

Since version 1.

§

Argb16161616f = 1_211_388_481

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

Since version 1.

§

Abgr16161616f = 1_211_384_385

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

Since version 1.

§

Xyuv8888 = 1_448_434_008

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

Since version 1.

§

Vuy888 = 875_713_878

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

Since version 1.

§

Vuy101010 = 808_670_550

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

Since version 1.

§

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

Since version 1.

§

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

Since version 1.

§

Y216 = 909_193_817

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

Since version 1.

§

Y410 = 808_531_033

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

Since version 1.

§

Y412 = 842_085_465

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

Since version 1.

§

Y416 = 909_194_329

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

Since version 1.

§

Xvyu2101010 = 808_670_808

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

Since version 1.

§

Xvyu1216161616 = 909_334_104

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

Since version 1.

§

Xvyu16161616 = 942_954_072

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

Since version 1.

§

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

Since version 1.

§

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

Since version 1.

§

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

Since version 1.

§

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

Since version 1.

§

Yuv4208bit = 942_691_673

Since version 1.

§

Yuv42010bit = 808_539_481

Since version 1.

§

Xrgb8888A8 = 943_805_016

Since version 1.

§

Xbgr8888A8 = 943_800_920

Since version 1.

§

Rgbx8888A8 = 943_806_546

Since version 1.

§

Bgrx8888A8 = 943_806_530

Since version 1.

§

Rgb888A8 = 943_798_354

Since version 1.

§

Bgr888A8 = 943_798_338

Since version 1.

§

Rgb565A8 = 943_797_586

Since version 1.

§

Bgr565A8 = 943_797_570

Since version 1.

§

Nv24 = 875_714_126

non-subsampled Cr:Cb plane

Since version 1.

§

Nv42 = 842_290_766

non-subsampled Cb:Cr plane

Since version 1.

§

P210 = 808_530_512

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

Since version 1.

§

P010 = 808_530_000

2x2 subsampled Cr:Cb plane 10 bits per channel

Since version 1.

§

P012 = 842_084_432

2x2 subsampled Cr:Cb plane 12 bits per channel

Since version 1.

§

P016 = 909_193_296

2x2 subsampled Cr:Cb plane 16 bits per channel

Since version 1.

§

Axbxgxrx106106106106 = 808_534_593

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

Since version 1.

§

Nv15 = 892_425_806

2x2 subsampled Cr:Cb plane

Since version 1.

§

Q410 = 808_531_025

Since version 1.

§

Q401 = 825_242_705

Since version 1.

§

Xrgb16161616 = 942_953_048

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

Since version 1.

§

Xbgr16161616 = 942_948_952

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

Since version 1.

§

Argb16161616 = 942_953_025

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

Since version 1.

§

Abgr16161616 = 942_948_929

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

Since version 1.

§

C1 = 538_980_675

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

Since version 1.

§

C2 = 538_980_931

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

Since version 1.

§

C4 = 538_981_443

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

Since version 1.

§

D1 = 538_980_676

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

Since version 1.

§

D2 = 538_980_932

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

Since version 1.

§

D4 = 538_981_444

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

Since version 1.

§

D8 = 538_982_468

[7:0] D

Since version 1.

§

R1 = 538_980_690

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

Since version 1.

§

R2 = 538_980_946

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

Since version 1.

§

R4 = 538_981_458

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

Since version 1.

§

R10 = 540_029_266

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

Since version 1.

§

R12 = 540_160_338

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

Since version 1.

§

Avuy8888 = 1_498_764_865

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

Since version 1.

§

Xvuy8888 = 1_498_764_888

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

Since version 1.

§

P030 = 808_661_072

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

Since version 1.

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 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 TryFrom<u32> for Format

Source§

type Error = ()

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

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

Performs the conversion.
Source§

impl Copy for Format

Source§

impl Eq for Format

Source§

impl StructuralPartialEq for Format

Auto Trait Implementations§

§

impl Freeze for Format

§

impl RefUnwindSafe for Format

§

impl Send for Format

§

impl Sync for Format

§

impl Unpin for Format

§

impl UnwindSafe for Format

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.