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