Returns true if the point falls within the canvas bounds.
(&self, xy: PixelsXY)
| 354 | |
| 355 | /// Returns true if the point falls within the canvas bounds. |
| 356 | fn contains_pixel(&self, xy: PixelsXY) -> bool { |
| 357 | xy.x >= 0 |
| 358 | && xy.y >= 0 |
| 359 | && u16::try_from(xy.x).unwrap_or(u16::MAX) < self.size_pixels.width |
| 360 | && u16::try_from(xy.y).unwrap_or(u16::MAX) < self.size_pixels.height |
| 361 | } |
| 362 | |
| 363 | /// Reproduces `tone` using SDL's audio queue. |
| 364 | fn play_tone(&mut self, tone: Tone) -> io::Result<()> { |