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
/* patterns.rs
 *
 * Developed by Tim Walls <tim.walls@snowgoons.com>
 * Copyright (c) All Rights Reserved, Tim Walls
 */
//! @todo documentation for this module
//!
//!

// Imports ===================================================================
use avrox_display::gfx::{GfxResult, Point};
use avrox_display::gfx::pixels::Monochromatic;
use avr_oxide::OxideResult::Ok;

// Declarations ==============================================================



// Code ======================================================================
pub fn vertical_pinstripe(coord: Point) -> GfxResult<Monochromatic> {
  if (coord.0 & 0b00000001) > 0 {
    Ok(Monochromatic::WHITE)
  } else {
    Ok(Monochromatic::BLACK)
  }
}

pub fn horizontal_pinstripe(coord: Point) -> GfxResult<Monochromatic> {
  if (coord.1 & 0b00000001) > 0 {
    Ok(Monochromatic::WHITE)
  } else {
    Ok(Monochromatic::BLACK)
  }
}

pub fn crosshatch(coord: Point) -> GfxResult<Monochromatic> {
  if (coord.0 & 0b00000001) > 0 {
    if (coord.1 & 0b00000001) > 0 {
      Ok(Monochromatic::WHITE)
    } else {
      Ok(Monochromatic::BLACK)
    }
  } else {
    if (coord.1 & 0b00000001) > 0 {
      Ok(Monochromatic::BLACK)
    } else {
      Ok(Monochromatic::WHITE)
    }
  }
}



// Tests =====================================================================