Skip to main content

r/interpreter/
graphics.rs

1//! Graphics subsystem — plot data model, View() data model, color system,
2//! and rendering backends.
3//!
4//! The data structures are always available. The interactive egui backends
5//! are gated behind `feature = "plot"` and `feature = "view"`.
6
7pub mod color;
8pub mod par;
9pub mod plot_data;
10pub mod view;
11
12#[cfg(feature = "plot")]
13pub mod egui_device;
14
15#[cfg(feature = "svg-device")]
16pub mod svg_device;
17
18#[cfg(feature = "pdf-device")]
19pub mod pdf;
20
21#[cfg(feature = "raster-device")]
22pub mod raster;
23
24#[cfg(all(feature = "plot", feature = "io"))]
25pub mod csv_drop;
26
27// region: FileDevice
28
29/// A file-based graphics device (SVG, PNG, PDF, JPEG, BMP).
30#[derive(Debug, Clone)]
31pub struct FileDevice {
32    pub filename: String,
33    pub format: FileFormat,
34    pub width: f64,
35    pub height: f64,
36    /// JPEG quality (1-100), only used for JPEG format.
37    pub jpeg_quality: u8,
38}
39
40/// Supported file device formats.
41#[derive(Debug, Clone, Copy)]
42pub enum FileFormat {
43    Svg,
44    Png,
45    Pdf,
46    Jpeg,
47    Bmp,
48}
49
50// endregion