1use tiny_skia::*;
2
3fn main() {
6 let mut paint = Paint::default();
7 paint.set_color_rgba8(0, 127, 0, 200);
8 paint.anti_alias = true;
9
10 let path = {
11 let mut pb = PathBuilder::new();
12 const RADIUS: f32 = 250.0;
13 const CENTER: f32 = 250.0;
14 pb.move_to(CENTER + RADIUS, CENTER);
15 for i in 1..8 {
16 let a = 2.6927937 * i as f32;
17 pb.line_to(CENTER + RADIUS * a.cos(), CENTER + RADIUS * a.sin());
18 }
19 pb.finish().unwrap()
20 };
21
22 let mut stroke = Stroke::default();
23 stroke.width = 6.0;
24 stroke.line_cap = LineCap::Round;
25 stroke.dash = StrokeDash::new(vec![20.0, 40.0], 0.0);
26
27 let mut pixmap = Pixmap::new(500, 500).unwrap();
28 pixmap.stroke_path(&path, &paint, &stroke, Transform::identity(), None);
29 pixmap.save_png("image.png").unwrap();
30}