/// Converts grayscale-with-alpha image data into grayscale-without-alpha.
Converts grayscale-with-alpha image data into grayscale-without-alpha.
Converts grayscale - with - alpha image data into grayscale - without - alpha .
fn grayalpha_to_gray(grayalpha: &[u8]) -> Box<[u8]> {
    assert_eq!(grayalpha.len() % 2, 0);
    let num_pixels = grayalpha.len() / 2;
    let mut gray = Vec::with_capacity(num_pixels);
    for i in 0..num_pixels {
        let value = grayalpha[2 * i];
        gray.push(value);
    }
    gray.into_boxed_slice()
}
fn grayalpha_to_gray ( grayalpha : & [ u8 ] ) -> Box < [ u8 ] > { assert_eq ! ( grayalpha len ( ) 2 0 ) ; let num_pixels = grayalpha . len ( ) / 2 ; let mut gray = Vec :: with_capacity ( num_pixels ) ; for i in 0 .. num_pixels { let value = grayalpha [ 2 * i ] ; gray . push ( value ) ; } gray . into_boxed_slice ( ) }
Converts grayscale-with-alpha image data into grayscale-without-alpha.
Converts grayscale - with - alpha image data into grayscale - without - alpha .
grayalpha
&[u8]