Draft new iced_graphics crate 🎉

This commit is contained in:
Héctor Ramón Jiménez 2020-05-19 17:15:44 +02:00
parent d4743183d4
commit 05af8d00d4
100 changed files with 861 additions and 1755 deletions

30
graphics/src/backend.rs Normal file
View file

@ -0,0 +1,30 @@
use iced_native::image;
use iced_native::svg;
use iced_native::{Font, Size};
pub trait Backend {
fn trim_measurements(&mut self) {}
}
pub trait Text {
const ICON_FONT: Font;
const CHECKMARK_ICON: char;
fn measure(
&self,
contents: &str,
size: f32,
font: Font,
bounds: Size,
) -> (f32, f32);
fn space_width(&self, size: f32) -> f32;
}
pub trait Image {
fn dimensions(&self, handle: &image::Handle) -> (u32, u32);
}
pub trait Svg {
fn viewport_dimensions(&self, handle: &svg::Handle) -> (u32, u32);
}