#[repr(u32)]
#[non_exhaustive]
pub enum Format {
Show 108 variants
Argb8888,
Xrgb8888,
C8,
Rgb332,
Bgr233,
Xrgb4444,
Xbgr4444,
Rgbx4444,
Bgrx4444,
Argb4444,
Abgr4444,
Rgba4444,
Bgra4444,
Xrgb1555,
Xbgr1555,
Rgbx5551,
Bgrx5551,
Argb1555,
Abgr1555,
Rgba5551,
Bgra5551,
Rgb565,
Bgr565,
Rgb888,
Bgr888,
Xbgr8888,
Rgbx8888,
Bgrx8888,
Abgr8888,
Rgba8888,
Bgra8888,
Xrgb2101010,
Xbgr2101010,
Rgbx1010102,
Bgrx1010102,
Argb2101010,
Abgr2101010,
Rgba1010102,
Bgra1010102,
Yuyv,
Yvyu,
Uyvy,
Vyuy,
Ayuv,
Nv12,
Nv21,
Nv16,
Nv61,
Yuv410,
Yvu410,
Yuv411,
Yvu411,
Yuv420,
Yvu420,
Yuv422,
Yvu422,
Yuv444,
Yvu444,
R8,
R16,
Rg88,
Gr88,
Rg1616,
Gr1616,
Xrgb16161616f,
Xbgr16161616f,
Argb16161616f,
Abgr16161616f,
Xyuv8888,
Vuy888,
Vuy101010,
Y210,
Y212,
Y216,
Y410,
Y412,
Y416,
Xvyu2101010,
Xvyu1216161616,
Xvyu16161616,
Y0l0,
X0l0,
Y0l2,
X0l2,
Yuv4208bit,
Yuv42010bit,
Xrgb8888A8,
Xbgr8888A8,
Rgbx8888A8,
Bgrx8888A8,
Rgb888A8,
Bgr888A8,
Rgb565A8,
Bgr565A8,
Nv24,
Nv42,
P210,
P010,
P012,
P016,
Axbxgxrx106106106106,
Nv15,
Q410,
Q401,
Xrgb16161616,
Xbgr16161616,
Argb16161616,
Abgr16161616,
}
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
Argb8888
32-bit ARGB format, [31:0] A:R:G:B 8:8:8:8 little endian
Xrgb8888
32-bit RGB format, [31:0] x:R:G:B 8:8:8:8 little endian
C8
8-bit color index format, [7:0] C
Rgb332
8-bit RGB format, [7:0] R:G:B 3:3:2
Bgr233
8-bit BGR format, [7:0] B:G:R 2:3:3
Xrgb4444
16-bit xRGB format, [15:0] x:R:G:B 4:4:4:4 little endian
Xbgr4444
16-bit xBGR format, [15:0] x:B:G:R 4:4:4:4 little endian
Rgbx4444
16-bit RGBx format, [15:0] R:G:B:x 4:4:4:4 little endian
Bgrx4444
16-bit BGRx format, [15:0] B:G:R:x 4:4:4:4 little endian
Argb4444
16-bit ARGB format, [15:0] A:R:G:B 4:4:4:4 little endian
Abgr4444
16-bit ABGR format, [15:0] A:B:G:R 4:4:4:4 little endian
Rgba4444
16-bit RBGA format, [15:0] R:G:B:A 4:4:4:4 little endian
Bgra4444
16-bit BGRA format, [15:0] B:G:R:A 4:4:4:4 little endian
Xrgb1555
16-bit xRGB format, [15:0] x:R:G:B 1:5:5:5 little endian
Xbgr1555
16-bit xBGR 1555 format, [15:0] x:B:G:R 1:5:5:5 little endian
Rgbx5551
16-bit RGBx 5551 format, [15:0] R:G:B:x 5:5:5:1 little endian
Bgrx5551
16-bit BGRx 5551 format, [15:0] B:G:R:x 5:5:5:1 little endian
Argb1555
16-bit ARGB 1555 format, [15:0] A:R:G:B 1:5:5:5 little endian
Abgr1555
16-bit ABGR 1555 format, [15:0] A:B:G:R 1:5:5:5 little endian
Rgba5551
16-bit RGBA 5551 format, [15:0] R:G:B:A 5:5:5:1 little endian
Bgra5551
16-bit BGRA 5551 format, [15:0] B:G:R:A 5:5:5:1 little endian
Rgb565
16-bit RGB 565 format, [15:0] R:G:B 5:6:5 little endian
Bgr565
16-bit BGR 565 format, [15:0] B:G:R 5:6:5 little endian
Rgb888
24-bit RGB format, [23:0] R:G:B little endian
Bgr888
24-bit BGR format, [23:0] B:G:R little endian
Xbgr8888
32-bit xBGR format, [31:0] x:B:G:R 8:8:8:8 little endian
Rgbx8888
32-bit RGBx format, [31:0] R:G:B:x 8:8:8:8 little endian
Bgrx8888
32-bit BGRx format, [31:0] B:G:R:x 8:8:8:8 little endian
Abgr8888
32-bit ABGR format, [31:0] A:B:G:R 8:8:8:8 little endian
Rgba8888
32-bit RGBA format, [31:0] R:G:B:A 8:8:8:8 little endian
Bgra8888
32-bit BGRA format, [31:0] B:G:R:A 8:8:8:8 little endian
Xrgb2101010
32-bit xRGB format, [31:0] x:R:G:B 2:10:10:10 little endian
Xbgr2101010
32-bit xBGR format, [31:0] x:B:G:R 2:10:10:10 little endian
Rgbx1010102
32-bit RGBx format, [31:0] R:G:B:x 10:10:10:2 little endian
Bgrx1010102
32-bit BGRx format, [31:0] B:G:R:x 10:10:10:2 little endian
Argb2101010
32-bit ARGB format, [31:0] A:R:G:B 2:10:10:10 little endian
Abgr2101010
32-bit ABGR format, [31:0] A:B:G:R 2:10:10:10 little endian
Rgba1010102
32-bit RGBA format, [31:0] R:G:B:A 10:10:10:2 little endian
Bgra1010102
32-bit BGRA format, [31:0] B:G:R:A 10:10:10:2 little endian
Yuyv
packed YCbCr format, [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian
Yvyu
packed YCbCr format, [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian
Uyvy
packed YCbCr format, [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian
Vyuy
packed YCbCr format, [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian
Ayuv
packed AYCbCr format, [31:0] A:Y:Cb:Cr 8:8:8:8 little endian
Nv12
2 plane YCbCr Cr:Cb format, 2x2 subsampled Cr:Cb plane
Nv21
2 plane YCbCr Cb:Cr format, 2x2 subsampled Cb:Cr plane
Nv16
2 plane YCbCr Cr:Cb format, 2x1 subsampled Cr:Cb plane
Nv61
2 plane YCbCr Cb:Cr format, 2x1 subsampled Cb:Cr plane
Yuv410
3 plane YCbCr format, 4x4 subsampled Cb (1) and Cr (2) planes
Yvu410
3 plane YCbCr format, 4x4 subsampled Cr (1) and Cb (2) planes
Yuv411
3 plane YCbCr format, 4x1 subsampled Cb (1) and Cr (2) planes
Yvu411
3 plane YCbCr format, 4x1 subsampled Cr (1) and Cb (2) planes
Yuv420
3 plane YCbCr format, 2x2 subsampled Cb (1) and Cr (2) planes
Yvu420
3 plane YCbCr format, 2x2 subsampled Cr (1) and Cb (2) planes
Yuv422
3 plane YCbCr format, 2x1 subsampled Cb (1) and Cr (2) planes
Yvu422
3 plane YCbCr format, 2x1 subsampled Cr (1) and Cb (2) planes
Yuv444
3 plane YCbCr format, non-subsampled Cb (1) and Cr (2) planes
Yvu444
3 plane YCbCr format, non-subsampled Cr (1) and Cb (2) planes
R8
[7:0] R
R16
[15:0] R little endian
Rg88
[15:0] R:G 8:8 little endian
Gr88
[15:0] G:R 8:8 little endian
Rg1616
[31:0] R:G 16:16 little endian
Gr1616
[31:0] G:R 16:16 little endian
Xrgb16161616f
[63:0] x:R:G:B 16:16:16:16 little endian
Xbgr16161616f
[63:0] x:B:G:R 16:16:16:16 little endian
Argb16161616f
[63:0] A:R:G:B 16:16:16:16 little endian
Abgr16161616f
[63:0] A:B:G:R 16:16:16:16 little endian
Xyuv8888
[31:0] X:Y:Cb:Cr 8:8:8:8 little endian
Vuy888
[23:0] Cr:Cb:Y 8:8:8 little endian
Vuy101010
Y followed by U then V, 10:10:10. Non-linear modifier only
Y210
[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
[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
[63:0] Cr0:Y1:Cb0:Y0 16:16:16:16 little endian per 2 Y pixels
Y410
[31:0] A:Cr:Y:Cb 2:10:10:10 little endian
Y412
[63:0] A:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian
Y416
[63:0] A:Cr:Y:Cb 16:16:16:16 little endian
Xvyu2101010
[31:0] X:Cr:Y:Cb 2:10:10:10 little endian
Xvyu1216161616
[63:0] X:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian
Xvyu16161616
[63:0] X:Cr:Y:Cb 16:16:16:16 little endian
Y0l0
[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
[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
[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
[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
Yuv42010bit
Xrgb8888A8
Xbgr8888A8
Rgbx8888A8
Bgrx8888A8
Rgb888A8
Bgr888A8
Rgb565A8
Bgr565A8
Nv24
non-subsampled Cr:Cb plane
Nv42
non-subsampled Cb:Cr plane
P210
2x1 subsampled Cr:Cb plane, 10 bit per channel
P010
2x2 subsampled Cr:Cb plane 10 bits per channel
P012
2x2 subsampled Cr:Cb plane 12 bits per channel
P016
2x2 subsampled Cr:Cb plane 16 bits per channel
Axbxgxrx106106106106
[63:0] A:x:B:x:G:x:R:x 10:6:10:6:10:6:10:6 little endian
Nv15
2x2 subsampled Cr:Cb plane
Q410
Q401
Xrgb16161616
[63:0] x:R:G:B 16:16:16:16 little endian
Xbgr16161616
[63:0] x:B:G:R 16:16:16:16 little endian
Argb16161616
[63:0] A:R:G:B 16:16:16:16 little endian
Abgr16161616
[63:0] A:B:G:R 16:16:16:16 little endian
Implementations
Trait Implementations
sourceimpl PartialEq<Format> for Format
impl PartialEq<Format> for Format
impl Copy for Format
impl StructuralPartialEq for Format
Auto Trait Implementations
impl RefUnwindSafe for Format
impl Send for Format
impl Sync for Format
impl Unpin for Format
impl UnwindSafe for Format
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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
. Read more
sourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcefn as_any(&self) -> &(dyn Any + 'static)
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. Read more
sourcefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
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. Read more