diff options
author | Akshay <[email protected]> | 2021-03-23 07:38:54 +0000 |
---|---|---|
committer | Akshay <[email protected]> | 2021-03-23 07:38:54 +0000 |
commit | 66c427ef00014f5939ba23f00fbc7f8fd089b66b (patch) | |
tree | a173d27f533ae0ceaa6fa822f725410950d46d4e /src/bitmap.rs | |
parent | 6541f29a0eb16ba2a0459376d38466b8563f5d2d (diff) |
add invert function and keybinds
Diffstat (limited to 'src/bitmap.rs')
-rw-r--r-- | src/bitmap.rs | 8 |
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 | ||
234 | impl Pixmap<bool> { | ||
235 | pub fn invert(&mut self) { | ||
236 | for px in self.data.iter_mut() { | ||
237 | *px = !(*px); | ||
238 | } | ||
239 | } | ||
240 | } | ||
241 | |||
234 | fn abs_difference<T: Sub<Output = T> + Ord>(x: T, y: T) -> T { | 242 | fn 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 |