summaryrefslogtreecommitdiffstats
path: root/graphics/src/backend.rs
blob: 3fcb42f7df6e4e2fc052fef535eff58899fb52ed (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
29
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);
}