summaryrefslogtreecommitdiffstats
path: root/graphics/src/backend.rs
blob: ee4eca0a888863f01919408b4a6d0fd5663ee5ba (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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);
}

pub trait Image {
    fn dimensions(&self, handle: &image::Handle) -> (u32, u32);
}

pub trait Svg {
    fn viewport_dimensions(&self, handle: &svg::Handle) -> (u32, u32);
}