aboutsummaryrefslogtreecommitdiff
path: root/lvc/src/lib.rs
blob: 5ebd91cca3e6af00d004ed0acf7c05bc21954e22 (plain)
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
#![feature(portable_simd)]
#![feature(io_error_other)]
#![feature(box_syntax)]

pub mod debug;
pub mod decode;
pub mod diff;
pub mod encode;
pub mod huff;
pub mod impls;
pub mod serialize;
pub mod split;

pub type PixelValue = i16;

#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
pub struct Pixel {
    pub r: PixelValue,
    pub g: PixelValue,
    pub b: PixelValue,
}

#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
pub struct P2 {
    pub x: i32,
    pub y: i32,
}

pub struct Frame {
    pub size: P2,
    pub pixels: Vec<Pixel>,
}

#[derive(Debug, Clone, Copy)]
pub struct View {
    pub a: P2,
    pub b: P2,
}

#[derive(Debug, Clone)]
pub enum Block {
    Split(Box<Block>, Box<Block>),
    Lit(Vec<Pixel>),
    Ref(Ref),
}

#[derive(Debug, Clone, Copy, Default)]
pub struct Ref {
    pub pos_off: P2,
    pub color_off: Pixel,
}