Introduce Image struct in core::image

This commit is contained in:
Héctor Ramón Jiménez 2024-08-04 04:30:12 +02:00
parent 974ae6d1e7
commit 92bd3ecd6b
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
19 changed files with 184 additions and 334 deletions

View file

@ -160,11 +160,8 @@ impl<Message> canvas::Program<Message> for State {
frame.translate(Vector::new(center.x, center.y));
frame.draw_image(
&self.sun,
Rectangle::with_radius(Self::SUN_RADIUS),
image::FilterMethod::Linear,
0,
1.0,
&self.sun,
);
let orbit = Path::circle(Point::ORIGIN, Self::ORBIT_RADIUS);
@ -189,22 +186,16 @@ impl<Message> canvas::Program<Message> for State {
frame.translate(Vector::new(Self::ORBIT_RADIUS, 0.0));
frame.draw_image(
&self.earth,
Rectangle::with_radius(Self::EARTH_RADIUS),
image::FilterMethod::Linear,
rotation * 20.0,
1.0,
canvas::Image::new(&self.earth).rotation(rotation * 20.0),
);
frame.rotate(rotation * 10.0);
frame.translate(Vector::new(0.0, Self::MOON_DISTANCE));
frame.draw_image(
&self.moon,
Rectangle::with_radius(Self::MOON_RADIUS),
image::FilterMethod::Linear,
0,
1.0,
&self.moon,
);
});