radar-g/src/render/foreground/mod.rs

40 lines
1.1 KiB
Rust

mod imp;
use crate::{data::mapper::Mapper, render::WindowCoord};
use femtovg::{renderer::OpenGl, Canvas, Path};
use glib::subclass::types::ObjectSubclassIsExt;
use gtk::{ffi::gtk_widget_get_width, glib, graphene::Rect, prelude::SnapshotExtManual};
use ndarray::Array2;
use std::ops::Range;
pub use self::imp::ForegroundConfig;
glib::wrapper! {
pub struct ForegroundWidget(ObjectSubclass<imp::ForegroundWidget>);
}
impl Default for ForegroundWidget {
fn default() -> Self {
Self::new(ForegroundConfig::default())
}
}
impl ForegroundWidget {
pub fn new(config: ForegroundConfig) -> Self {
let this: Self = glib::Object::new();
let imp = this.imp();
imp.config.replace(config);
this
}
pub fn draw(&self, canvas: &mut Canvas<OpenGl>, scale: f32, dpi: i32, mapper: &Mapper) {
let canvas_widht = canvas.width();
let canvas_height = canvas.height();
let config = self.imp().config.borrow();
}
pub(super) fn set_dims(&mut self, dims: (Array2<f64>, Array2<f64>)) {
self.imp().dim1.replace(Some(dims.0));
self.imp().dim2.replace(Some(dims.1));
}
}