summaryrefslogtreecommitdiffstats
path: root/examples/clock
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-02-12 06:41:24 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-02-12 06:41:24 +0100
commit74dd79e97f83d3e9e13d87444740edeb353f9be8 (patch)
tree22c5d14e7aec9eb3d268424d6deaa3fad32513d9 /examples/clock
parent64097983f195ac1e923b6a1bd8cb0fc2c109fabc (diff)
downloadiced-74dd79e97f83d3e9e13d87444740edeb353f9be8.tar.gz
iced-74dd79e97f83d3e9e13d87444740edeb353f9be8.tar.bz2
iced-74dd79e97f83d3e9e13d87444740edeb353f9be8.zip
Rename current `Path` to `path::Builder`
Diffstat (limited to 'examples/clock')
-rw-r--r--examples/clock/src/main.rs42
1 files changed, 21 insertions, 21 deletions
diff --git a/examples/clock/src/main.rs b/examples/clock/src/main.rs
index dc2c06cf..76752d20 100644
--- a/examples/clock/src/main.rs
+++ b/examples/clock/src/main.rs
@@ -86,17 +86,17 @@ impl canvas::layer::Drawable for LocalTime {
let center = frame.center();
let radius = frame.width().min(frame.height()) as f32 / 2.0;
- let mut path = canvas::Path::new();
-
- path.arc(canvas::path::Arc {
- center,
- radius,
- start_angle: 0.0,
- end_angle: 360.0 * 2.0 * std::f32::consts::PI,
+ let path = canvas::Path::new(|path| {
+ path.arc(canvas::path::Arc {
+ center,
+ radius,
+ start_angle: 0.0,
+ end_angle: 360.0 * 2.0 * std::f32::consts::PI,
+ })
});
frame.fill(
- path,
+ &path,
canvas::Fill::Color(Color::from_rgb8(0x12, 0x93, 0xD8)),
);
@@ -104,7 +104,7 @@ impl canvas::layer::Drawable for LocalTime {
n: u32,
total: u32,
length: f32,
- path: &mut canvas::Path,
+ path: &mut canvas::path::Builder,
) {
let turns = n as f32 / total as f32;
let t = 2.0 * std::f32::consts::PI * (turns - 0.25);
@@ -115,16 +115,16 @@ impl canvas::layer::Drawable for LocalTime {
path.line_to(Point::new(x, y));
}
- let mut path = canvas::Path::new();
-
- path.move_to(center);
- draw_handle(self.hour, 12, 0.6 * radius, &mut path);
+ let path = canvas::Path::new(|path| {
+ path.move_to(center);
+ draw_handle(self.hour, 12, 0.6 * radius, path);
- path.move_to(center);
- draw_handle(self.minute, 60, 0.9 * radius, &mut path);
+ path.move_to(center);
+ draw_handle(self.minute, 60, 0.9 * radius, path)
+ });
frame.stroke(
- path,
+ &path,
canvas::Stroke {
width: 4.0,
color: Color::WHITE,
@@ -133,13 +133,13 @@ impl canvas::layer::Drawable for LocalTime {
},
);
- let mut path = canvas::Path::new();
-
- path.move_to(center);
- draw_handle(self.second, 60, 0.9 * radius, &mut path);
+ let path = canvas::Path::new(|path| {
+ path.move_to(center);
+ draw_handle(self.second, 60, 0.9 * radius, path)
+ });
frame.stroke(
- path,
+ &path,
canvas::Stroke {
width: 2.0,
color: Color::WHITE,