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