summaryrefslogtreecommitdiffstats
path: root/graphics/src/widget/svg.rs
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/src/widget/svg.rs')
-rw-r--r--graphics/src/widget/svg.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/graphics/src/widget/svg.rs b/graphics/src/widget/svg.rs
new file mode 100644
index 00000000..b1aa7cea
--- /dev/null
+++ b/graphics/src/widget/svg.rs
@@ -0,0 +1,28 @@
+use crate::backend::{self, Backend};
+use crate::{Primitive, Renderer};
+use iced_native::{mouse, svg, Layout};
+
+pub use iced_native::Svg;
+
+impl<B> svg::Renderer for Renderer<B>
+where
+ B: Backend + backend::Svg,
+{
+ fn dimensions(&self, handle: &svg::Handle) -> (u32, u32) {
+ self.backend().viewport_dimensions(handle)
+ }
+
+ fn draw(
+ &mut self,
+ handle: svg::Handle,
+ layout: Layout<'_>,
+ ) -> Self::Output {
+ (
+ Primitive::Svg {
+ handle,
+ bounds: layout.bounds(),
+ },
+ mouse::Interaction::default(),
+ )
+ }
+}