INNER CODE UNIT · Rust

Some

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

        if let Some(rgb_image) = self.image.as_rgba8() {
            rgb_image.hash(state);
        }
        self.size.hash(state);
        (self.scale as i64).hash(state);
    }
}

impl Bitmap {
    #[inline]
    /// Creates a bitmap from the given `DynamicImage`, and scale if given
    /// (defaults to 1).
    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,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…