1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#[cfg(not(target_arch = "wasm32"))]
pub use tiny_skia::IntRect as Rect;
#[derive(Debug, Clone, Copy, Default)]
pub struct Size {
pub width: u32,
pub height: u32,
}
#[derive(Clone, Copy, Debug)]
pub enum PixelFormat {
Rgb,
Rgba,
AlphaMap([u8; 3]),
}
#[cfg(not(target_arch = "wasm32"))]
#[derive(Debug, Clone)]
pub struct Texture {
pub total_size: Size,
pub rect: Rect,
pub data: Vec<u8>,
pub format: PixelFormat,
}
#[cfg(not(target_arch = "wasm32"))]
impl Texture {
pub fn new_empty() -> Self {
Self {
total_size: Size::default(),
rect: Rect::from_xywh(0, 0, 1, 1).unwrap(),
data: vec![0, 0, 0, 0],
format: PixelFormat::Rgba,
}
}
}
#[derive(Debug, Clone)]
pub enum EmbeddedResourcesKind {
RawData,
TextureData(#[cfg(not(target_arch = "wasm32"))] Texture),
}
#[derive(Debug, Clone)]
pub struct EmbeddedResources {
pub id: usize,
pub kind: EmbeddedResourcesKind,
}