sweep_gradient/
sweep-gradient.rs

1fn main() {
2    use raqote::*;
3
4let mut dt = DrawTarget::new(400, 400);
5
6let mut pb = PathBuilder::new();
7pb.rect(0., 0., 400., 400.);
8let path = pb.finish();
9
10let gradient = Source::new_sweep_gradient(
11    Gradient {
12        stops: vec![
13            GradientStop {
14                position: 0.,
15                color: Color::new(0xff, 0, 0, 0),
16            },
17            GradientStop {
18                position: 0.5,
19                color: Color::new(0xff, 0xff, 0xff, 0x0),
20            },
21            GradientStop {
22                position: 1.,
23                color: Color::new(0xff, 0, 0, 0x0),
24            },
25        ],
26    },
27    Point::new(150., 200.),
28    45.,
29    180.+45.,
30    Spread::Repeat,
31);
32dt.fill(&path, &gradient, &DrawOptions::new());
33
34
35
36dt.write_png("example.png");
37}