From 7dc622b9e774c1f8b085e18aeb231de4e4190e91 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Tue, 17 Mar 2020 23:25:29 +0100 Subject: [PATCH] library: core: film: add width/height methods --- src/core/film.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/core/film.rs b/src/core/film.rs index a674f1c..3cc5d3a 100644 --- a/src/core/film.rs +++ b/src/core/film.rs @@ -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) { (x / self.x as f32, y / self.y as f32) }