INNER CODE UNIT · Rust
bounds
autopilot-rs/autopilot-rs · src/bitmap.rs:81
pub fn bounds(&self) -> Rect {
Rect::new(Point::ZERO, self.size)
}
/// Copies image to pasteboard. Currently only supported on macOS.
pub fn copy_to_pasteboard(&self) -> ImageResult<()> {
self.system_copy_to_pasteboard()
}
/// Returns new Bitmap created from a portion of another.
pub fn cropped(&mut self, rect: Rect) -> ImageResult<Bitmap> {
if !self.bounds().is_rect_visible(rect) {
Err(ImageError::Limits(LimitError::from_kind(
LimitErrorKind::DimensionError,
)))
} else {
let rect = rect.scaled(self.scale).round();
let cropped_image = self.image.crop(