qr_encode/qr_encoder/
cell.rs

1#[derive(Copy, Clone, Debug)]
2pub struct Color {
3    pub r: u32,
4    pub g: u32,
5    pub b: u32
6}
7
8#[derive(Debug, Clone)]
9pub enum CellType {
10    Finder,
11    Alignment,
12    Separator,
13    Timing,
14    DarkModule,
15    VersionInformation,
16    Format,
17    Message,
18    None
19}
20
21
22#[derive(Debug, Clone)]
23pub struct Cell {
24    pub module_type: CellType,
25    pub value: u8,
26    pub point: Point<usize>,
27    pub color: Color
28}
29
30impl Cell {
31    pub fn is_black(&self) -> bool {
32        self.color.r == 0 && self.color.g == 0 && self.color.b == 0
33    }
34}
35
36#[derive(Debug, Copy, Clone)]
37pub struct Point<T>(pub T, pub T);
38
39
40#[derive(Debug)]
41pub struct PlotPoint {
42    pub point: Point<usize>,
43    pub color: Color
44}