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

        Self { level: u16::try_from(converted).expect("Color brigthness bug") }
    }
/// Spreads this brightness so it becomes distributed along the range of
/// brightness, assuming the maximum value it could be is the one given
/// by `soft_max`.
///
/// # Panics
/// Panics if `self.level > soft_max` (or if conversion is incorrect).
Spreads this brightness so it becomes distributed along the range of
brightness, assuming the maximum value it could be is the one given
by `soft_max`.
Spreads this brightness so it becomes distributed along the range of brightness assuming the maximum value it could be is the one given by ` soft_max ` .
pub(crate) fn spread(self, soft_max: u16) -> Self {
        assert!(self.level <= soft_max);
        let level = u32::from(self.level);
        let soft_max = u32::from(soft_max);
        let max = u32::from(u16::max_value());
        let converted = (level * max + soft_max / 2 + 1) / soft_max;
        Self { level: u16::try_from(converted).expect("Color brigthness bug") }
    }
pub ( crate ) fn spread ( self , soft_max : u16 ) -> Self { assert ! ( self level soft_max ) ; let level = u32 :: from ( self . level ) ; let soft_max = u32 :: from ( soft_max ) ; let max = u32 :: from ( u16 :: max_value ( ) ) ; let converted = ( level * max + soft_max / 2 + 1 ) / soft_max ; Self { level : u16 :: try_from ( converted ) . expect ( " " ) } }
Spreads this brightness so it becomes distributed along the range of
brightness, assuming the maximum value it could be is the one given
by `soft_max`.
Spreads this brightness so it becomes distributed along the range of brightness assuming the maximum value it could be is the one given by ` soft_max ` .
self
soft_max
u16
self
soft_max
u16
panics
Panics if `self.level > soft_max` (or if conversion is incorrect).
Panics if ` self . level > soft_max ` ( or if conversion is incorrect ) .