pixel_sort/
lib.rs

1mod canvas;
2mod errors;
3mod render;
4
5pub use crate::{
6    canvas::VrellisCanvas,
7    errors::{Result, VrellisError},
8    render::{VrellisAlgorithm, VrellisColorMode, VrellisPoint, VrellisShape},
9};
10pub use image::{Luma, Rgb};
11use serde::{Deserialize, Serialize};
12
13#[derive(Debug, Clone, Serialize, Deserialize)]
14pub struct Vrellis {
15    /// The shape of the uniformly distributed point set on the convex hull
16    pub convex_shape: VrellisShape,
17    /// number of points
18    pub points: u32,
19    /// Color rendering mode, not all drawing modes are supported
20    pub color_mode: VrellisColorMode,
21    /// Algorithm to use when evaluating the next step
22    pub algorithm: VrellisAlgorithm,
23    /// `true`: Use multiply mode to paint on the black board
24    /// `false`: Use filter mode to paint on the white board
25    pub inverted_color: bool,
26    /// If the ordinal difference of two points is less than or equal to this value
27    /// Then there will be no connection between the two
28    pub min_distance: u32,
29    /// The basic width of the line when drawing
30    pub line_width: f32,
31    /* Whether to use highlight color to highlight the last step
32     * pub highlight_last_step: Option<Rgb<u8>>, */
33}
34
35impl Default for Vrellis {
36    fn default() -> Self {
37        Self {
38            convex_shape: Default::default(),
39            color_mode: Default::default(),
40            algorithm: Default::default(),
41            inverted_color: false,
42            points: 100,
43            min_distance: 0,
44            line_width: 1.0,
45        }
46    }
47}