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