aboutsummaryrefslogtreecommitdiff
path: root/evc/src/refsampler.rs
diff options
context:
space:
mode:
Diffstat (limited to 'evc/src/refsampler.rs')
-rw-r--r--evc/src/refsampler.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/evc/src/refsampler.rs b/evc/src/refsampler.rs
index 95e123b..db0ab6f 100644
--- a/evc/src/refsampler.rs
+++ b/evc/src/refsampler.rs
@@ -1,14 +1,21 @@
-use crate::{helpers::{matrix::Mat2, vector::Vec2}, frame::Frame};
+use crate::{
+ frame::Frame,
+ helpers::{matrix::Mat2, pixel::Pixel, vector::Vec2},
+};
+
+pub struct Sampler<'a> {
+ frame: &'a Frame,
-pub struct Sampler {
translation: Vec2<f32>,
transform: Mat2<f32>,
value_scale: f32,
}
-impl Sampler {
- pub fn sample(&self, frame: &Frame, p: Vec2<f32>) {
-
+impl Sampler<'_> {
+ pub fn sample(&self, p: Vec2<f32>) -> Pixel {
+ self.frame
+ .sample(self.translation + self.transform.transform(p))
+ .scale(self.value_scale)
}
}