INNER CODE UNIT · Rust
get_pixel
autopilot-rs/autopilot-rs · src/bitmap.rs:109
pub fn get_pixel(&self, point: Point) -> Rgba<u8> {
let point = point.scaled(self.multiplier()).round();
self.image.get_pixel(point.x as u32, point.y as u32)
}
/// Returns true if bitmap is equal to needle with the given tolerance.
pub fn bitmap_eq(&self, needle: &Bitmap, tolerance: Option<f64>) -> bool {
self.size == needle.size
&& self.scale == needle.scale
&& self.is_needle_at(Point::ZERO, needle, tolerance)
}
/// Attempts to find `color` inside `rect` in `bmp` from the given
/// `start_point`. Returns coordinates if found, or `None` if not. If
/// `rect` is `None`, `bmp.bounds()` is used instead. If `start_point` is
/// `None`, the origin of `rect` is used.
///
/// Tolerance is defined as a float in the range from 0 to 1, where 0 is