INNER CODE UNIT · Rust
new
autopilot-rs/autopilot-rs · src/bitmap.rs:67
pub fn new(image: DynamicImage, scale: Option<f64>) -> Bitmap {
let scale: f64 = scale.unwrap_or(1.0);
Bitmap {
size: Size::new(
f64::from(image.width()) / scale,
f64::from(image.height()) / scale,
),
image,
scale,
}
}
#[inline]
/// Returns bounds of bitmap as a rect, with an origin of zero.
pub fn bounds(&self) -> Rect {
Rect::new(Point::ZERO, self.size)
}