summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-21 05:52:48 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-21 05:52:48 +0100
commit188db4da48954b95a3fe79bcd22689ffc3a661e0 (patch)
tree8af47544c98c212b50c15e66458518974139b796 /core/src
parent2b00e8b1457b0ccbafe12db3dbd6431c2c72f275 (diff)
downloadiced-188db4da48954b95a3fe79bcd22689ffc3a661e0.tar.gz
iced-188db4da48954b95a3fe79bcd22689ffc3a661e0.tar.bz2
iced-188db4da48954b95a3fe79bcd22689ffc3a661e0.zip
Draft support for dynamic custom renderer injection
Diffstat (limited to 'core/src')
-rw-r--r--core/src/image.rs4
-rw-r--r--core/src/renderer.rs2
-rw-r--r--core/src/svg.rs9
3 files changed, 10 insertions, 5 deletions
diff --git a/core/src/image.rs b/core/src/image.rs
index e5fdcd83..32b95f03 100644
--- a/core/src/image.rs
+++ b/core/src/image.rs
@@ -186,11 +186,11 @@ pub trait Renderer: crate::Renderer {
type Handle: Clone + Hash;
/// Returns the dimensions of an image for the given [`Handle`].
- fn dimensions(&self, handle: &Self::Handle) -> Size<u32>;
+ fn measure_image(&self, handle: &Self::Handle) -> Size<u32>;
/// Draws an image with the given [`Handle`] and inside the provided
/// `bounds`.
- fn draw(
+ fn draw_image(
&mut self,
handle: Self::Handle,
filter_method: FilterMethod,
diff --git a/core/src/renderer.rs b/core/src/renderer.rs
index 1139b41c..47b09d32 100644
--- a/core/src/renderer.rs
+++ b/core/src/renderer.rs
@@ -10,7 +10,7 @@ use crate::{
};
/// A component that can be used by widgets to draw themselves on a screen.
-pub trait Renderer: Sized {
+pub trait Renderer {
/// Draws the primitives recorded in the given closure in a new layer.
///
/// The layer will clip its contents to the provided `bounds`.
diff --git a/core/src/svg.rs b/core/src/svg.rs
index d63e3c95..ab207cca 100644
--- a/core/src/svg.rs
+++ b/core/src/svg.rs
@@ -91,8 +91,13 @@ impl std::fmt::Debug for Data {
/// [renderer]: crate::renderer
pub trait Renderer: crate::Renderer {
/// Returns the default dimensions of an SVG for the given [`Handle`].
- fn dimensions(&self, handle: &Handle) -> Size<u32>;
+ fn measure_svg(&self, handle: &Handle) -> Size<u32>;
/// Draws an SVG with the given [`Handle`], an optional [`Color`] filter, and inside the provided `bounds`.
- fn draw(&mut self, handle: Handle, color: Option<Color>, bounds: Rectangle);
+ fn draw_svg(
+ &mut self,
+ handle: Handle,
+ color: Option<Color>,
+ bounds: Rectangle,
+ );
}