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
|
//! A rectangle with certain styled properties.
use bytemuck::{Pod, Zeroable};
/// The properties of a quad.
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
#[repr(C)]
pub struct Quad {
/// The position of the [`Quad`].
pub position: [f32; 2],
/// The size of the [`Quad`].
pub size: [f32; 2],
/// The border color of the [`Quad`], in __linear RGB__.
pub border_color: [f32; 4],
/// The border radii of the [`Quad`].
pub border_radius: [f32; 4],
/// The border width of the [`Quad`].
pub border_width: f32,
}
/// A quad filled with a solid color.
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
#[repr(C)]
pub struct Solid {
/// The background color data of the quad.
pub color: [f32; 4],
/// The [`Quad`] data of the [`Solid`].
pub quad: Quad,
}
/// A quad filled with interpolated colors.
#[derive(Clone, Copy, Debug)]
#[repr(C)]
pub struct Gradient {
/// The background gradient data of the quad.
pub gradient: [f32; 44],
/// The [`Quad`] data of the [`Gradient`].
pub quad: Quad,
}
#[allow(unsafe_code)]
unsafe impl Pod for Gradient {}
#[allow(unsafe_code)]
unsafe impl Zeroable for Gradient {}
|