pub fn new<I: IntoIterator<Item = C>>(colors: I) -> Gradient<C>
    where
        C::Scalar: FromF64,
    {
        let mut points: Vec<_> = colors.into_iter().map(|c| (C::Scalar::zero(), c)).collect();
        assert!(!points.is_empty());
        let step_size = C::Scalar::one() / from_f64(max(points.len() - 1, 1) as f64);

        for (i, &mut (ref mut p, _)) in points.iter_mut().enumerate() {
            *p = from_f64::<C::Scalar>(i as f64) * step_size;
        }

        Gradient(points, PhantomData)
    }
/// Create a gradient of evenly spaced colors with the domain [0.0, 1.0].
/// There must be at least one color.
Create a gradient of evenly spaced colors with the domain [0.0, 1.0].
There must be at least one color.
Create a gradient of evenly spaced colors with the domain [ 0 . 0 1 . 0 ] . There must be at least one color .
pub fn new<I: IntoIterator<Item = C>>(colors: I) -> Gradient<C>
    where
        C::Scalar: FromF64,
    {
        let mut points: Vec<_> = colors.into_iter().map(|c| (C::Scalar::zero(), c)).collect();
        assert!(!points.is_empty());
        let step_size = C::Scalar::one() / from_f64(max(points.len() - 1, 1) as f64);
        for (i, &mut (ref mut p, _)) in points.iter_mut().enumerate() {
            *p = from_f64::<C::Scalar>(i as f64) * step_size;
        }
        Gradient(points, PhantomData)
    }
pub fn new < I : IntoIterator < Item = C > > ( colors : I ) -> Gradient < C > where C :: Scalar : FromF64 , { let mut points : Vec < _ > = colors . into_iter ( ) . map ( | c | ( C :: Scalar :: zero ( ) , c ) ) . collect ( ) ; assert ! ( points is_empty ( ) ) ; let step_size = C :: Scalar :: one ( ) / from_f64 ( max ( points . len ( ) - 1 , 1 ) as f64 ) ; for ( i , & mut ( ref mut p , _ ) ) in points . iter_mut ( ) . enumerate ( ) { * p = from_f64 :: < C :: Scalar > ( i as f64 ) * step_size ; } Gradient ( points , PhantomData ) }
Create a gradient of evenly spaced colors with the domain [0.0, 1.0].
Create a gradient of evenly spaced colors with the domain [ 0 . 0 1 . 0 ] .
colors
I
colors
I