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
use crate::ui::{graphic, ice::widget::image};

#[derive(Debug)]
pub enum Primitive {
    // Allocation :(
    Group {
        primitives: Vec<Primitive>,
    },
    Image {
        handle: (image::Handle, graphic::Rotation),
        bounds: iced::Rectangle,
        color: vek::Rgba<u8>,
        source_rect: Option<vek::Aabr<f32>>,
    },
    // A vertical gradient
    // TODO: could be combined with rectangle
    Gradient {
        bounds: iced::Rectangle,
        top_linear_color: vek::Rgba<f32>,
        bottom_linear_color: vek::Rgba<f32>,
    },
    Rectangle {
        bounds: iced::Rectangle,
        linear_color: vek::Rgba<f32>,
    },
    Text {
        glyphs: Vec<glyph_brush::SectionGlyph>,
        bounds: iced::Rectangle,
        linear_color: vek::Rgba<f32>,
    },
    Clip {
        bounds: iced::Rectangle,
        offset: vek::Vec2<u32>,
        content: Box<Primitive>,
    },
    // Make content translucent
    Opacity {
        alpha: f32,
        content: Box<Primitive>,
    },
    Nothing,
}