library: core: film: add width/height methods

This commit is contained in:
Bruno BELANYI 2020-03-17 23:25:29 +01:00
parent 4c7085ab16
commit 7dc622b9e7

View file

@ -26,6 +26,14 @@ impl Film {
} }
} }
pub fn width(&self) -> u32 {
self.x
}
pub fn height(&self) -> u32 {
self.y
}
pub fn pixel_ratio(&self, x: f32, y: f32) -> (f32, f32) { pub fn pixel_ratio(&self, x: f32, y: f32) -> (f32, f32) {
(x / self.x as f32, y / self.y as f32) (x / self.x as f32, y / self.y as f32)
} }