iced_core/renderer/
null.rs
1use crate::alignment;
2use crate::image::{self, Image};
3use crate::renderer::{self, Renderer};
4use crate::svg;
5use crate::text::{self, Text};
6use crate::{
7 Background, Color, Font, Pixels, Point, Rectangle, Size, Transformation,
8};
9
10impl Renderer for () {
11 fn start_layer(&mut self, _bounds: Rectangle) {}
12
13 fn end_layer(&mut self) {}
14
15 fn start_transformation(&mut self, _transformation: Transformation) {}
16
17 fn end_transformation(&mut self) {}
18
19 fn clear(&mut self) {}
20
21 fn fill_quad(
22 &mut self,
23 _quad: renderer::Quad,
24 _background: impl Into<Background>,
25 ) {
26 }
27}
28
29impl text::Renderer for () {
30 type Font = Font;
31 type Paragraph = ();
32 type Editor = ();
33
34 const MONOSPACE_FONT: Font = Font::MONOSPACE;
35 const ICON_FONT: Font = Font::DEFAULT;
36 const CHECKMARK_ICON: char = '0';
37 const ARROW_DOWN_ICON: char = '0';
38
39 fn default_font(&self) -> Self::Font {
40 Font::default()
41 }
42
43 fn default_size(&self) -> Pixels {
44 Pixels(16.0)
45 }
46
47 fn fill_paragraph(
48 &mut self,
49 _paragraph: &Self::Paragraph,
50 _position: Point,
51 _color: Color,
52 _clip_bounds: Rectangle,
53 ) {
54 }
55
56 fn fill_editor(
57 &mut self,
58 _editor: &Self::Editor,
59 _position: Point,
60 _color: Color,
61 _clip_bounds: Rectangle,
62 ) {
63 }
64
65 fn fill_text(
66 &mut self,
67 _paragraph: Text,
68 _position: Point,
69 _color: Color,
70 _clip_bounds: Rectangle,
71 ) {
72 }
73}
74
75impl text::Paragraph for () {
76 type Font = Font;
77
78 fn with_text(_text: Text<&str>) -> Self {}
79
80 fn with_spans<Link>(
81 _text: Text<&[text::Span<'_, Link, Self::Font>], Self::Font>,
82 ) -> Self {
83 }
84
85 fn resize(&mut self, _new_bounds: Size) {}
86
87 fn compare(&self, _text: Text<()>) -> text::Difference {
88 text::Difference::None
89 }
90
91 fn size(&self) -> Pixels {
92 Pixels(16.0)
93 }
94
95 fn font(&self) -> Font {
96 Font::DEFAULT
97 }
98
99 fn line_height(&self) -> text::LineHeight {
100 text::LineHeight::default()
101 }
102
103 fn align_x(&self) -> text::Alignment {
104 text::Alignment::Default
105 }
106
107 fn align_y(&self) -> alignment::Vertical {
108 alignment::Vertical::Top
109 }
110
111 fn wrapping(&self) -> text::Wrapping {
112 text::Wrapping::default()
113 }
114
115 fn shaping(&self) -> text::Shaping {
116 text::Shaping::default()
117 }
118
119 fn grapheme_position(&self, _line: usize, _index: usize) -> Option<Point> {
120 None
121 }
122
123 fn bounds(&self) -> Size {
124 Size::ZERO
125 }
126
127 fn min_bounds(&self) -> Size {
128 Size::ZERO
129 }
130
131 fn hit_test(&self, _point: Point) -> Option<text::Hit> {
132 None
133 }
134
135 fn hit_span(&self, _point: Point) -> Option<usize> {
136 None
137 }
138
139 fn span_bounds(&self, _index: usize) -> Vec<Rectangle> {
140 vec![]
141 }
142}
143
144impl text::Editor for () {
145 type Font = Font;
146
147 fn with_text(_text: &str) -> Self {}
148
149 fn is_empty(&self) -> bool {
150 true
151 }
152
153 fn cursor(&self) -> text::editor::Cursor {
154 text::editor::Cursor::Caret(Point::ORIGIN)
155 }
156
157 fn cursor_position(&self) -> (usize, usize) {
158 (0, 0)
159 }
160
161 fn selection(&self) -> Option<String> {
162 None
163 }
164
165 fn line(&self, _index: usize) -> Option<text::editor::Line<'_>> {
166 None
167 }
168
169 fn line_count(&self) -> usize {
170 0
171 }
172
173 fn perform(&mut self, _action: text::editor::Action) {}
174
175 fn bounds(&self) -> Size {
176 Size::ZERO
177 }
178
179 fn min_bounds(&self) -> Size {
180 Size::ZERO
181 }
182
183 fn update(
184 &mut self,
185 _new_bounds: Size,
186 _new_font: Self::Font,
187 _new_size: Pixels,
188 _new_line_height: text::LineHeight,
189 _new_wrapping: text::Wrapping,
190 _new_highlighter: &mut impl text::Highlighter,
191 ) {
192 }
193
194 fn highlight<H: text::Highlighter>(
195 &mut self,
196 _font: Self::Font,
197 _highlighter: &mut H,
198 _format_highlight: impl Fn(
199 &H::Highlight,
200 ) -> text::highlighter::Format<Self::Font>,
201 ) {
202 }
203}
204
205impl image::Renderer for () {
206 type Handle = image::Handle;
207
208 fn measure_image(&self, _handle: &Self::Handle) -> Size<u32> {
209 Size::default()
210 }
211
212 fn draw_image(&mut self, _image: Image, _bounds: Rectangle) {}
213}
214
215impl svg::Renderer for () {
216 fn measure_svg(&self, _handle: &svg::Handle) -> Size<u32> {
217 Size::default()
218 }
219
220 fn draw_svg(&mut self, _svg: svg::Svg, _bounds: Rectangle) {}
221}