fidl_data_zbi/
graphics.rs1#![allow(unused_imports)]
9
10use zerocopy::IntoBytes;
11
12#[repr(u32)]
17#[derive(Clone, Copy, Debug, Eq, IntoBytes, PartialEq)]
18pub enum PixelFormat {
19 None = 0x00000000,
20 Rgb565 = 0x00020001,
21 Rgb332 = 0x00010002,
22 Rgb2220 = 0x00010003,
23 Argb8888 = 0x00040004,
24 RgbX888 = 0x00040005,
25 Mono8 = 0x00010007,
26 Nv12 = 0x00010008,
27 I420 = 0x00010009,
28 Rgb888 = 0x00030009,
29 Abgr8888 = 0x0004000a,
30 Bgr888X = 0x0004000b,
31 Argb2101010 = 0x0004000c,
32 Abgr2101010 = 0x0004000d,
33}
34
35impl PixelFormat {
36 pub fn from_raw(raw: u32) -> Option<Self> {
37 match raw {
38 0x00000000 => Some(Self::None),
39
40 0x00020001 => Some(Self::Rgb565),
41
42 0x00010002 => Some(Self::Rgb332),
43
44 0x00010003 => Some(Self::Rgb2220),
45
46 0x00040004 => Some(Self::Argb8888),
47
48 0x00040005 => Some(Self::RgbX888),
49
50 0x00010007 => Some(Self::Mono8),
51
52 0x00010008 => Some(Self::Nv12),
53
54 0x00010009 => Some(Self::I420),
55
56 0x00030009 => Some(Self::Rgb888),
57
58 0x0004000a => Some(Self::Abgr8888),
59
60 0x0004000b => Some(Self::Bgr888X),
61
62 0x0004000c => Some(Self::Argb2101010),
63
64 0x0004000d => Some(Self::Abgr2101010),
65
66 _ => None,
67 }
68 }
69}
70
71#[repr(C)]
73#[derive(Clone, Copy, Debug, Eq, IntoBytes, PartialEq)]
74pub struct Swfb {
75 pub base: u64,
77
78 pub width: u32,
80 pub height: u32,
81 pub stride: u32,
82 pub format: PixelFormat,
83}