From c545af35773307d16eca7ec03ed4794f26491da2 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 14 Apr 2020 06:49:15 +0200 Subject: Implement `canvas::Path::rectangle` helper method --- examples/solar_system/src/main.rs | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'examples') diff --git a/examples/solar_system/src/main.rs b/examples/solar_system/src/main.rs index d2c6e38f..067f8ff2 100644 --- a/examples/solar_system/src/main.rs +++ b/examples/solar_system/src/main.rs @@ -133,9 +133,7 @@ impl canvas::Drawable for State { let center = frame.center(); - let space = Path::new(|path| { - path.rectangle(Point::new(0.0, 0.0), frame.size()) - }); + let space = Path::rectangle(Point::new(0.0, 0.0), frame.size()); let stars = Path::new(|path| { for (p, size) in &self.stars { @@ -174,15 +172,10 @@ impl canvas::Drawable for State { path.circle(Point::ORIGIN, Self::EARTH_RADIUS) }); - let shadow = Path::new(|path| { - path.rectangle( - Point::new(0.0, -Self::EARTH_RADIUS), - Size::new( - Self::EARTH_RADIUS * 4.0, - Self::EARTH_RADIUS * 2.0, - ), - ) - }); + let shadow = Path::rectangle( + Point::new(0.0, -Self::EARTH_RADIUS), + Size::new(Self::EARTH_RADIUS * 4.0, Self::EARTH_RADIUS * 2.0), + ); frame.fill(&earth, Color::from_rgb8(0x6B, 0x93, 0xD6)); -- cgit