1use crate::engine::common::Barcode1DKind;
2use crate::{FontManager, ZplResult};
3
4#[allow(clippy::too_many_arguments)]
9pub trait ZplForgeBackend {
10 fn setup_page(&mut self, width: f64, height: f64, resolution: f32);
12
13 fn new_page(&mut self) -> ZplResult<()> {
19 Ok(())
20 }
21
22 fn setup_font_manager(&mut self, font_manager: &FontManager);
24
25 fn draw_text(
31 &mut self,
32 x: u32,
33 y: u32,
34 font: char,
35 height: Option<u32>,
36 width: Option<u32>,
37 orientation: char,
38 text: &str,
39 reverse_print: bool,
40 color: Option<String>,
41 ) -> ZplResult<()>;
42
43 fn draw_graphic_box(
45 &mut self,
46 x: u32,
47 y: u32,
48 width: u32,
49 height: u32,
50 thickness: u32,
51 color: char,
52 custom_color: Option<String>,
53 rounding: u32,
54 reverse_print: bool,
55 ) -> ZplResult<()>;
56
57 fn draw_graphic_circle(
59 &mut self,
60 x: u32,
61 y: u32,
62 radius: u32,
63 thickness: u32,
64 color: char,
65 custom_color: Option<String>,
66 reverse_print: bool,
67 ) -> ZplResult<()>;
68
69 fn draw_graphic_ellipse(
71 &mut self,
72 x: u32,
73 y: u32,
74 width: u32,
75 height: u32,
76 thickness: u32,
77 color: char,
78 custom_color: Option<String>,
79 reverse_print: bool,
80 ) -> ZplResult<()>;
81
82 fn draw_graphic_field(
84 &mut self,
85 x: u32,
86 y: u32,
87 width: u32,
88 height: u32,
89 data: &[u8],
90 reverse_print: bool,
91 ) -> ZplResult<()>;
92
93 fn draw_graphic_image_custom(
98 &mut self,
99 x: u32,
100 y: u32,
101 width: u32,
102 height: u32,
103 data: &str,
104 ) -> ZplResult<()>;
105
106 fn draw_code128(
108 &mut self,
109 x: u32,
110 y: u32,
111 orientation: char,
112 height: u32,
113 module_width: u32,
114 interpretation_line: char,
115 interpretation_line_above: char,
116 check_digit: char,
117 mode: char,
118 data: &str,
119 reverse_print: bool,
120 ) -> ZplResult<()>;
121
122 fn draw_qr_code(
124 &mut self,
125 x: u32,
126 y: u32,
127 orientation: char,
128 model: u32,
129 magnification: u32,
130 error_correction: char,
131 mask: u32,
132 data: &str,
133 reverse_print: bool,
134 ) -> ZplResult<()>;
135
136 #[allow(clippy::too_many_arguments)]
138 fn draw_barcode_1d(
139 &mut self,
140 kind: Barcode1DKind,
141 x: u32,
142 y: u32,
143 orientation: char,
144 height: u32,
145 module_width: u32,
146 interpretation_line: char,
147 interpretation_line_above: char,
148 data: &str,
149 reverse_print: bool,
150 ) -> ZplResult<()>;
151
152 #[allow(clippy::too_many_arguments)]
154 fn draw_graphic_diagonal(
155 &mut self,
156 x: u32,
157 y: u32,
158 width: u32,
159 height: u32,
160 thickness: u32,
161 color: char,
162 custom_color: Option<String>,
163 diagonal_orientation: char,
164 reverse_print: bool,
165 ) -> ZplResult<()>;
166
167 fn draw_datamatrix(
171 &mut self,
172 x: u32,
173 y: u32,
174 orientation: char,
175 module_size: u32,
176 data: &str,
177 reverse_print: bool,
178 ) -> ZplResult<()>;
179
180 fn draw_pdf417(
186 &mut self,
187 x: u32,
188 y: u32,
189 orientation: char,
190 row_height: u32,
191 module_width: u32,
192 security_level: u32,
193 data: &str,
194 reverse_print: bool,
195 ) -> ZplResult<()>;
196
197 fn draw_code39(
199 &mut self,
200 x: u32,
201 y: u32,
202 orientation: char,
203 check_digit: char,
204 height: u32,
205 module_width: u32,
206 interpretation_line: char,
207 interpretation_line_above: char,
208 data: &str,
209 reverse_print: bool,
210 ) -> ZplResult<()>;
211
212 fn finalize(&mut self) -> ZplResult<Vec<u8>>;
214}