aboutsummaryrefslogtreecommitdiff
path: root/src/drawing/backend_impl/mod.rs
blob: 719f3750b39e98a9019d911ccc50d431d659a00c (plain)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#[cfg(feature = "svg")]
mod svg;
#[cfg(feature = "svg")]
pub use self::svg::SVGBackend;

#[cfg(feature = "bitmap")]
mod bitmap;
#[cfg(feature = "bitmap")]
pub use bitmap::BitMapBackend;

#[cfg(feature = "bitmap")]
pub mod bitmap_pixel {
    pub use super::bitmap::{BGRXPixel, PixelFormat, RGBPixel};
}

#[cfg(target_arch = "wasm32")]
mod canvas;
#[cfg(target_arch = "wasm32")]
pub use canvas::CanvasBackend;

#[cfg(test)]
mod mocked;
#[cfg(test)]
pub use mocked::{create_mocked_drawing_area, MockedBackend};

#[cfg(all(not(target_arch = "wasm32"), feature = "piston"))]
mod piston;
#[cfg(all(not(target_arch = "wasm32"), feature = "piston"))]
pub use piston::{draw_piston_window, PistonBackend};

#[cfg(all(not(target_arch = "wasm32"), feature = "cairo-rs"))]
mod cairo;
#[cfg(all(not(target_arch = "wasm32"), feature = "cairo-rs"))]
pub use self::cairo::CairoBackend;

/// This is the dummy backend placeholder for the backend that never fails
#[derive(Debug)]
pub struct DummyBackendError;

impl std::fmt::Display for DummyBackendError {
    fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
        write!(fmt, "{:?}", self)
    }
}

impl std::error::Error for DummyBackendError {}