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

pub mod diff;
pub mod encode;
pub mod impls;

pub type PixelValue = u8;

#[repr(C, align(2))]
#[derive(Debug, Clone, Copy, Default)]
pub struct Pixel {
    pub r: PixelValue,
    pub g: PixelValue,
    pub b: PixelValue,
}

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

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

pub struct View {
    pub a: P2,
    pub b: P2,
}

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

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