primitives/foundation/
image.rs1use bytes::Bytes;
2
3#[derive(Copy, Clone, Debug)]
5pub enum PixelFormat {
6 Invalid,
8 ARgb32,
10 Rgb24,
12 A8,
14 A1,
16 Rgb16_565,
18 Rgb30,
20}
21
22impl Default for PixelFormat {
23 fn default() -> Self {
24 PixelFormat::ARgb32
25 }
26}
27
28#[derive(Debug, Clone)]
30pub struct ImageData {
31 pub format: PixelFormat,
33 pub width: u32,
35 pub height: u32,
37 pub data: Bytes,
39}
40
41impl ImageData {
42 pub fn new(format: PixelFormat, width: u32, height: u32, data: Bytes) -> Self {
44 Self {
45 format,
46 width,
47 height,
48 data,
49 }
50 }
51}
52
53impl Default for ImageData {
54 fn default() -> Self {
55 Self {
56 format: Default::default(),
57 width: 0,
58 height: 0,
59 data: Default::default(),
60 }
61 }
62}