INNER CODE UNIT · Rust

point_in_bounds

autopilot-rs/autopy · src/bitmap.rs:127

    fn point_in_bounds(&self, x: f64, y: f64) -> PyResult<bool> {
        Ok(self.bitmap.bounds().is_point_visible(Point::new(x, y)))
    }

    /// Returns `True` if the given rect of the form `((x, y), (width,
    /// height))` is contained in `bmp.bounds`.
    fn rect_in_bounds(&self, rect: ((f64, f64), (f64, f64))) -> PyResult<bool> {
        let rect = Rect::new(
            Point::new((rect.0).0, (rect.0).1),
            Size::new((rect.1).0, (rect.1).1),
        );
        Ok(self.bitmap.bounds().is_rect_visible(rect))
    }

    /// Open the image located at the path specified. The image's format is
    /// determined from the path's file extension.
    #[classmethod]
    fn open(cls: &Bound<'_, PyType>, path: String) -> PyResult<Py<Bitmap>> {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…