aboutsummaryrefslogtreecommitdiff
path: root/src/bitmap.rs
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-03-23 07:38:54 +0000
committerAkshay <[email protected]>2021-03-23 07:38:54 +0000
commit66c427ef00014f5939ba23f00fbc7f8fd089b66b (patch)
treea173d27f533ae0ceaa6fa822f725410950d46d4e /src/bitmap.rs
parent6541f29a0eb16ba2a0459376d38466b8563f5d2d (diff)
add invert function and keybinds
Diffstat (limited to 'src/bitmap.rs')
-rw-r--r--src/bitmap.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/bitmap.rs b/src/bitmap.rs
index d02cafb..c7e8fd4 100644
--- a/src/bitmap.rs
+++ b/src/bitmap.rs
@@ -231,6 +231,14 @@ where
231 } 231 }
232} 232}
233 233
234impl Pixmap<bool> {
235 pub fn invert(&mut self) {
236 for px in self.data.iter_mut() {
237 *px = !(*px);
238 }
239 }
240}
241
234fn abs_difference<T: Sub<Output = T> + Ord>(x: T, y: T) -> T { 242fn abs_difference<T: Sub<Output = T> + Ord>(x: T, y: T) -> T {
235 if x < y { 243 if x < y {
236 y - x 244 y - x