Draft new iced_graphics crate 🎉
This commit is contained in:
parent
d4743183d4
commit
05af8d00d4
100 changed files with 861 additions and 1755 deletions
26
graphics/src/renderer/widget/svg.rs
Normal file
26
graphics/src/renderer/widget/svg.rs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
use crate::backend::{self, Backend};
|
||||
use crate::{Primitive, Renderer};
|
||||
use iced_native::{mouse, svg, Layout};
|
||||
|
||||
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(),
|
||||
)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue