MCPcopy Create free account
hub / github.com/endbasic/endbasic / contains_pixel

Method contains_pixel

web/src/canvas.rs:148–153  ·  view source on GitHub ↗

Returns true if the point falls within the canvas bounds.

(&self, xy: PixelsXY)

Source from the content-addressed store, hash-verified

146
147 /// Returns true if the point falls within the canvas bounds.
148 fn contains_pixel(&self, xy: PixelsXY) -> bool {
149 xy.x >= 0
150 && xy.y >= 0
151 && u16::try_from(xy.x).unwrap_or(u16::MAX) < self.size_pixels.width
152 && u16::try_from(xy.y).unwrap_or(u16::MAX) < self.size_pixels.height
153 }
154
155 /// Sets the fill color of the canvas to `rgb`.
156 fn set_fill_style_rgb(&mut self, rgb: RGB) {

Callers 1

peek_pixelMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected