summaryrefslogtreecommitdiffstats
path: root/graphics/src/geometry/frame.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-08-04 04:30:12 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-08-04 04:30:12 +0200
commit92bd3ecd6b4a6618f0fc725dea3694c3b40e5314 (patch)
tree8040fe0f758eb41cbf587119c5d972f5ebaa8567 /graphics/src/geometry/frame.rs
parent974ae6d1e7cd9df6967762a6d308106f4fe03edc (diff)
downloadiced-92bd3ecd6b4a6618f0fc725dea3694c3b40e5314.tar.gz
iced-92bd3ecd6b4a6618f0fc725dea3694c3b40e5314.tar.bz2
iced-92bd3ecd6b4a6618f0fc725dea3694c3b40e5314.zip
Introduce `Image` struct in `core::image`
Diffstat (limited to '')
-rw-r--r--graphics/src/geometry/frame.rs39
1 files changed, 5 insertions, 34 deletions
diff --git a/graphics/src/geometry/frame.rs b/graphics/src/geometry/frame.rs
index d53d1331..1a7af8e6 100644
--- a/graphics/src/geometry/frame.rs
+++ b/graphics/src/geometry/frame.rs
@@ -1,8 +1,7 @@
//! Draw and generate geometry.
-use crate::core::image;
use crate::core::svg;
use crate::core::{Color, Point, Radians, Rectangle, Size, Vector};
-use crate::geometry::{self, Fill, Path, Stroke, Text};
+use crate::geometry::{self, Fill, Image, Path, Stroke, Text};
/// The region of a surface that can be used to draw geometry.
#[allow(missing_debug_implementations)]
@@ -79,21 +78,8 @@ where
/// Draws the given image on the [`Frame`] inside the given bounds.
#[cfg(feature = "image")]
- pub fn draw_image(
- &mut self,
- handle: &image::Handle,
- bounds: Rectangle,
- filter_method: image::FilterMethod,
- rotation: impl Into<Radians>,
- opacity: f32,
- ) {
- self.raw.draw_image(
- handle,
- bounds,
- filter_method,
- rotation.into(),
- opacity,
- );
+ pub fn draw_image(&mut self, bounds: Rectangle, image: impl Into<Image>) {
+ self.raw.draw_image(bounds, image);
}
/// Stores the current transform of the [`Frame`] and executes the given
@@ -219,14 +205,7 @@ pub trait Backend: Sized {
fill: impl Into<Fill>,
);
- fn draw_image(
- &mut self,
- handle: &image::Handle,
- bounds: Rectangle,
- filter_method: image::FilterMethod,
- rotation: Radians,
- opacity: f32,
- );
+ fn draw_image(&mut self, bounds: Rectangle, image: impl Into<Image>);
fn draw_svg(
&mut self,
@@ -285,15 +264,7 @@ impl Backend for () {
fn into_geometry(self) -> Self::Geometry {}
- fn draw_image(
- &mut self,
- _handle: &image::Handle,
- _bounds: Rectangle,
- _filter_method: image::FilterMethod,
- _rotation: Radians,
- _opacity: f32,
- ) {
- }
+ fn draw_image(&mut self, _bounds: Rectangle, _image: impl Into<Image>) {}
fn draw_svg(
&mut self,