pub(crate) fn compress(self, soft_max: u16) -> Self {
        let level = u32::from(self.level);
        let soft_max = u32::from(soft_max);
        let max = u32::from(u16::max_value());
        let converted = (level * soft_max + max / 2 + 1) / max;

        Self { level: u16::try_from(converted).expect("Color brigthness bug") }
    }
/// Compress this brightness so it becomes a value between zero and the
/// maximum value, given by `max`.
///
/// # Panics
/// Panics if conversion is incorrect.
Compress this brightness so it becomes a value between zero and the
maximum value, given by `max`.
Compress this brightness so it becomes a value between zero and the maximum value given by ` max ` .
pub(crate) fn compress(self, soft_max: u16) -> Self {
        let level = u32::from(self.level);
        let soft_max = u32::from(soft_max);
        let max = u32::from(u16::max_value());
        let converted = (level * soft_max + max / 2 + 1) / max;
        Self { level: u16::try_from(converted).expect("Color brigthness bug") }
    }
pub ( crate ) fn compress ( self , soft_max : u16 ) -> Self { let level = u32 :: from ( self . level ) ; let soft_max = u32 :: from ( soft_max ) ; let max = u32 :: from ( u16 :: max_value ( ) ) ; let converted = ( level * soft_max + max / 2 + 1 ) / max ; Self { level : u16 :: try_from ( converted ) . expect ( " " ) } }
Compress this brightness so it becomes a value between zero and the
maximum value, given by `max`.
Compress this brightness so it becomes a value between zero and the maximum value given by ` max ` .
self
soft_max
u16
self
soft_max
u16
panics
Panics if conversion is incorrect.
Panics if conversion is incorrect .