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
55
56
57
58
use crate::Address;
use crate::ColorAddress;
use StepType::*;
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct Stroker {
pub pattern: Address,
pub width: Address,
pub color: ColorAddress,
}
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct Triangle {
pub points: [Address; 3],
pub colors: [ColorAddress; 3],
}
#[derive(Debug, Copy, Clone, PartialEq)]
pub enum StepType {
Arc,
CubicCurve,
QuadraticCurve,
Line,
}
pub type TriangleIndex = usize;
pub type StepIndex = usize;
pub type Path = Vec<(StepType, StepIndex)>;
pub type PathIndex = usize;
pub type Background = Vec<TriangleIndex>;
pub type BackgroundIndex = usize;
pub type StrokerIndex = usize;
#[derive(Debug, Copy, Clone, PartialEq)]
pub enum RenderingStep {
Clip(PathIndex, BackgroundIndex),
Stroke(PathIndex, StrokerIndex),
}
pub const STEP_TYPES: [StepType; 4] = [
Arc,
CubicCurve,
QuadraticCurve,
Line,
];
impl StepType {
pub fn as_u32(self) -> u32 {
match self {
Arc => 0,
CubicCurve => 1,
QuadraticCurve => 2,
Line => 3,
}
}
}