iced_core/renderer/
null.rs

1use crate::alignment;
2use crate::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    type Raw = ();
34
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(14.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_raw(&mut self, _raw: Self::Raw) {}
66
67    fn fill_text(
68        &mut self,
69        _paragraph: Text,
70        _position: Point,
71        _color: Color,
72        _clip_bounds: Rectangle,
73    ) {
74    }
75}
76
77impl text::Paragraph for () {
78    type Font = Font;
79
80    fn with_text(_text: Text<&str>) -> Self {}
81
82    fn with_spans<Link>(
83        _text: Text<&[text::Span<'_, Link, Self::Font>], Self::Font>,
84    ) -> Self {
85    }
86
87    fn resize(&mut self, _new_bounds: Size) {}
88
89    fn compare(&self, _text: Text<()>) -> text::Difference {
90        text::Difference::None
91    }
92
93    fn horizontal_alignment(&self) -> alignment::Horizontal {
94        alignment::Horizontal::Left
95    }
96
97    fn vertical_alignment(&self) -> alignment::Vertical {
98        alignment::Vertical::Top
99    }
100
101    fn grapheme_position(&self, _line: usize, _index: usize) -> Option<Point> {
102        None
103    }
104
105    fn min_bounds(&self) -> Size {
106        Size::ZERO
107    }
108
109    fn hit_test(&self, _point: Point) -> Option<text::Hit> {
110        None
111    }
112
113    fn hit_span(&self, _point: Point) -> Option<usize> {
114        None
115    }
116
117    fn span_bounds(&self, _index: usize) -> Vec<Rectangle> {
118        vec![]
119    }
120}
121
122impl text::Editor for () {
123    type Font = Font;
124
125    fn with_text(_text: &str) -> Self {}
126
127    fn is_empty(&self) -> bool {
128        true
129    }
130
131    fn cursor(&self) -> text::editor::Cursor {
132        text::editor::Cursor::Caret(Point::ORIGIN)
133    }
134
135    fn cursor_position(&self) -> (usize, usize) {
136        (0, 0)
137    }
138
139    fn selection(&self) -> Option<String> {
140        None
141    }
142
143    fn line(&self, _index: usize) -> Option<&str> {
144        None
145    }
146
147    fn line_count(&self) -> usize {
148        0
149    }
150
151    fn perform(&mut self, _action: text::editor::Action) {}
152
153    fn bounds(&self) -> Size {
154        Size::ZERO
155    }
156
157    fn min_bounds(&self) -> Size {
158        Size::ZERO
159    }
160
161    fn update(
162        &mut self,
163        _new_bounds: Size,
164        _new_font: Self::Font,
165        _new_size: Pixels,
166        _new_line_height: text::LineHeight,
167        _new_wrapping: text::Wrapping,
168        _new_highlighter: &mut impl text::Highlighter,
169    ) {
170    }
171
172    fn highlight<H: text::Highlighter>(
173        &mut self,
174        _font: Self::Font,
175        _highlighter: &mut H,
176        _format_highlight: impl Fn(
177            &H::Highlight,
178        ) -> text::highlighter::Format<Self::Font>,
179    ) {
180    }
181}
182
183impl image::Renderer for () {
184    type Handle = image::Handle;
185
186    fn measure_image(&self, _handle: &Self::Handle) -> Size<u32> {
187        Size::default()
188    }
189
190    fn draw_image(
191        &mut self,
192        _handle: Self::Handle,
193        _filter_method: image::FilterMethod,
194        _bounds: Rectangle,
195        _rotation: crate::Radians,
196        _opacity: f32,
197        _border_radius: [f32; 4],
198    ) {
199    }
200}
201
202impl svg::Renderer for () {
203    fn measure_svg(&self, _handle: &svg::Handle) -> Size<u32> {
204        Size::default()
205    }
206
207    fn draw_svg(&mut self, _svg: svg::Svg, _bounds: Rectangle) {}
208}