rust_motion_paths/
types.rs1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
7pub struct Point {
8 pub x: f64,
9 pub y: f64,
10}
11
12impl Point {
13 pub fn new(x: f64, y: f64) -> Self {
14 Self { x, y }
15 }
16}
17
18#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
20pub enum Instruction {
21 MoveTo { x: f64, y: f64 },
23 LineTo { x: f64, y: f64 },
25 CubicCurveTo {
27 x1: f64,
28 y1: f64,
29 x2: f64,
30 y2: f64,
31 x: f64,
32 y: f64,
33 },
34 QuadCurveTo { x1: f64, y1: f64, x: f64, y: f64 },
36 ArcTo {
38 rx: f64,
39 ry: f64,
40 x_axis_rotation: f64,
41 large_arc_flag: bool,
42 sweep_flag: bool,
43 x: f64,
44 y: f64,
45 },
46 ClosePath,
48}
49
50#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
52pub struct EvolvedPath {
53 pub stroke_dasharray: String,
55 pub stroke_dashoffset: f64,
57}
58
59#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
61pub struct BoundingBox {
62 pub x: f64,
63 pub y: f64,
64 pub width: f64,
65 pub height: f64,
66}
67
68impl BoundingBox {
69 pub fn new(x: f64, y: f64, width: f64, height: f64) -> Self {
70 Self {
71 x,
72 y,
73 width,
74 height,
75 }
76 }
77}