Add the Mask node (#1080)

* Add MaskImageNode

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
This commit is contained in:
isiko 2023-04-09 04:56:03 +02:00 committed by Keavon Chambers
parent ea02a2d53a
commit 9c4164291c
7 changed files with 56 additions and 4 deletions

View file

@ -442,7 +442,7 @@ mod image {
&mut self.image.data[y * (self.image.width as usize) + x]
}
/// Clamps the provided point to (0, 0) (ImageSize) and returns the closest pixel
/// Clamps the provided point to ((0, 0), (ImageSize.x, ImageSize.y)) and returns the closest pixel
pub fn sample(&self, position: DVec2) -> Color {
let x = position.x.clamp(0., self.image.width as f64 - 1.) as usize;
let y = position.y.clamp(0., self.image.height as f64 - 1.) as usize;