1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
use Buffer;
use crateBufferGetPixel;
// impl Buffer {
// // /// Safely get the pixel color of the buffer at the specified x and y, returns the fallback input if the pixel is out of bounds
// // #[inline(always)]
// // #[must_use]
// // pub const fn get_pixel_fallback(
// // &self,
// // xy: (usize, usize),
// // fallback: u32,
// // ) -> u32 {
// // if xy.0 >= self.width || xy.1 >= self.height {
// // return fallback;
// // }
// // let index = xy.1 * self.width + xy.0;
// // unsafe { *self.data.as_ptr().add(index) }
// // }
// // /// Get the pixel color at a position in a buffer yet before that check if it is in the range of the buffer
// // /// Instead of returning None if the result isn't in the buffer, it will return the specified fallback value
// // #[inline(always)]
// // #[must_use]
// // #[allow(clippy::cast_sign_loss)]
// // pub fn get_pixel_isize_fallback(
// // &self,
// // xy: (isize, isize),
// // fallback: u32,
// // ) -> u32 {
// // if xy.0 < 0 || xy.1 < 0 {
// // return fallback;
// // }
// // let y = xy.1 as usize;
// // let x = xy.0 as usize;
// // if x >= self.width || y >= self.height {
// // return fallback;
// // }
// // let index = y * self.width + x;
// // self.data[index]
// // }
// }