INNER CODE UNIT · Rust

is_needle_oversized

autopilot-rs/autopilot-rs · src/bitmap.rs:285

    fn is_needle_oversized(&self, needle: &Bitmap) -> bool {
        needle.scale > self.scale
            || needle.bounds().size.width > self.bounds().size.width
            || needle.bounds().size.height > self.bounds().size.height
    }

    fn is_needle_at(&self, pt: Point, needle: &Bitmap, tolerance: Option<f64>) -> bool {
        let bounds = needle.bounds();
        for x in bounds.origin.x as u64..bounds.max_x() as u64 {
            for y in bounds.origin.y as u64..bounds.max_y() as u64 {
                let needle_point = Point::new(x as f64, y as f64);
                let haystack_point = Point::new(pt.x + needle_point.x, pt.y + needle_point.y);
                if !self.bounds().is_point_visible(haystack_point) {
                    return false;
                }

                let c1 = needle.get_pixel(needle_point);
                let c2 = self.get_pixel(haystack_point);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…