iced_core/renderer/
null.rs

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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
use crate::alignment;
use crate::image;
use crate::renderer::{self, Renderer};
use crate::svg;
use crate::text::{self, Text};
use crate::{
    Background, Color, Font, Pixels, Point, Rectangle, Size, Transformation,
};

impl Renderer for () {
    fn start_layer(&mut self, _bounds: Rectangle) {}

    fn end_layer(&mut self) {}

    fn start_transformation(&mut self, _transformation: Transformation) {}

    fn end_transformation(&mut self) {}

    fn clear(&mut self) {}

    fn fill_quad(
        &mut self,
        _quad: renderer::Quad,
        _background: impl Into<Background>,
    ) {
    }
}

impl text::Renderer for () {
    type Font = Font;
    type Paragraph = ();
    type Editor = ();
    type Raw = ();

    const ICON_FONT: Font = Font::DEFAULT;
    const CHECKMARK_ICON: char = '0';
    const ARROW_DOWN_ICON: char = '0';

    fn default_font(&self) -> Self::Font {
        Font::default()
    }

    fn default_size(&self) -> Pixels {
        Pixels(14.0)
    }

    fn fill_paragraph(
        &mut self,
        _paragraph: &Self::Paragraph,
        _position: Point,
        _color: Color,
        _clip_bounds: Rectangle,
    ) {
    }

    fn fill_editor(
        &mut self,
        _editor: &Self::Editor,
        _position: Point,
        _color: Color,
        _clip_bounds: Rectangle,
    ) {
    }

    fn fill_raw(&mut self, _raw: Self::Raw) {}

    fn fill_text(
        &mut self,
        _paragraph: Text,
        _position: Point,
        _color: Color,
        _clip_bounds: Rectangle,
    ) {
    }
}

impl text::Paragraph for () {
    type Font = Font;

    fn with_text(_text: Text<&str>) -> Self {}

    fn with_spans<Link>(
        _text: Text<&[text::Span<'_, Link, Self::Font>], Self::Font>,
    ) -> Self {
    }

    fn resize(&mut self, _new_bounds: Size) {}

    fn compare(&self, _text: Text<()>) -> text::Difference {
        text::Difference::None
    }

    fn horizontal_alignment(&self) -> alignment::Horizontal {
        alignment::Horizontal::Left
    }

    fn vertical_alignment(&self) -> alignment::Vertical {
        alignment::Vertical::Top
    }

    fn grapheme_position(&self, _line: usize, _index: usize) -> Option<Point> {
        None
    }

    fn min_bounds(&self) -> Size {
        Size::ZERO
    }

    fn hit_test(&self, _point: Point) -> Option<text::Hit> {
        None
    }

    fn hit_span(&self, _point: Point) -> Option<usize> {
        None
    }

    fn span_bounds(&self, _index: usize) -> Vec<Rectangle> {
        vec![]
    }
}

impl text::Editor for () {
    type Font = Font;

    fn with_text(_text: &str) -> Self {}

    fn is_empty(&self) -> bool {
        true
    }

    fn cursor(&self) -> text::editor::Cursor {
        text::editor::Cursor::Caret(Point::ORIGIN)
    }

    fn cursor_position(&self) -> (usize, usize) {
        (0, 0)
    }

    fn selection(&self) -> Option<String> {
        None
    }

    fn line(&self, _index: usize) -> Option<&str> {
        None
    }

    fn line_count(&self) -> usize {
        0
    }

    fn perform(&mut self, _action: text::editor::Action) {}

    fn bounds(&self) -> Size {
        Size::ZERO
    }

    fn min_bounds(&self) -> Size {
        Size::ZERO
    }

    fn update(
        &mut self,
        _new_bounds: Size,
        _new_font: Self::Font,
        _new_size: Pixels,
        _new_line_height: text::LineHeight,
        _new_wrapping: text::Wrapping,
        _new_highlighter: &mut impl text::Highlighter,
    ) {
    }

    fn highlight<H: text::Highlighter>(
        &mut self,
        _font: Self::Font,
        _highlighter: &mut H,
        _format_highlight: impl Fn(
            &H::Highlight,
        ) -> text::highlighter::Format<Self::Font>,
    ) {
    }
}

impl image::Renderer for () {
    type Handle = image::Handle;

    fn measure_image(&self, _handle: &Self::Handle) -> Size<u32> {
        Size::default()
    }

    fn draw_image(
        &mut self,
        _handle: Self::Handle,
        _filter_method: image::FilterMethod,
        _bounds: Rectangle,
        _rotation: crate::Radians,
        _opacity: f32,
        _border_radius: [f32; 4],
    ) {
    }
}

impl svg::Renderer for () {
    fn measure_svg(&self, _handle: &svg::Handle) -> Size<u32> {
        Size::default()
    }

    fn draw_svg(&mut self, _svg: svg::Svg, _bounds: Rectangle) {}
}