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
66
67
68
69
70
71
72
#[cfg(debug_assertions)]
mod null;
#[cfg(debug_assertions)]
pub use null::Null;
use crate::layout;
use crate::{Background, Color, Element, Rectangle, Vector};
pub trait Renderer: Sized {
fn layout<'a, Message>(
&mut self,
element: &Element<'a, Message, Self>,
limits: &layout::Limits,
) -> layout::Node {
element.layout(self, limits)
}
fn with_layer(&mut self, bounds: Rectangle, f: impl FnOnce(&mut Self));
fn with_translation(
&mut self,
translation: Vector,
f: impl FnOnce(&mut Self),
);
fn clear(&mut self);
fn fill_quad(&mut self, quad: Quad, background: impl Into<Background>);
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Quad {
pub bounds: Rectangle,
pub border_radius: f32,
pub border_width: f32,
pub border_color: Color,
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Style {
pub text_color: Color,
}
impl Default for Style {
fn default() -> Self {
Style {
text_color: Color::BLACK,
}
}
}