1#![doc = include_str!("../README.md")]
2pub mod dcam560;
5pub mod scepter;
6
7pub mod util;
8
9pub const DEFAULT_RESOLUTION: Resolution = Resolution::new(640, 480);
11
12pub const DEFAULT_PIXEL_COUNT: usize = DEFAULT_RESOLUTION.to_pixel_count();
14
15pub enum ColorFormat {
17 Rgb,
18 Bgr,
19}
20
21#[derive(PartialEq)]
23pub enum ColorResolution {
24 Res640x480,
25 Res800x600,
26 Res1600x1200,
27}
28
29#[derive(PartialEq)]
31pub struct Resolution {
32 width: u32,
33 height: u32,
34}
35impl Resolution {
36 pub const fn new(w: u32, h: u32) -> Self {
37 Self {
38 width: w,
39 height: h,
40 }
41 }
42 pub const fn to_array(&self) -> [u32; 2] {
43 [self.width, self.height]
44 }
45 pub const fn to_tuple(&self) -> (u32, u32) {
46 (self.width, self.height)
47 }
48 pub const fn to_pixel_count(&self) -> usize {
49 (self.width * self.height) as usize
50 }
51 pub const fn double(&self) -> Self {
52 Self {
53 width: 2 * self.width,
54 height: 2 * self.height,
55 }
56 }
57}
58
59pub enum DepthMeasuringRange {
61 Near,
62 Mid,
63 Far,
64}
65
66#[macro_export]
68#[doc(hidden)]
69macro_rules! red {
70 ($($arg:tt)*) => {format!("\x1b[31m{}\x1b[0m", format_args!($($arg)*))}
71}
72#[macro_export]
74#[doc(hidden)]
75macro_rules! yellow {
76 ($($arg:tt)*) => {format!("\x1b[33m{}\x1b[0m", format_args!($($arg)*))}
77}
78#[macro_export]
80#[doc(hidden)]
81macro_rules! cyan {
82 ($($arg:tt)*) => {format!("\x1b[36m{}\x1b[0m", format_args!($($arg)*))}
83}