Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
27 lines (23 sloc) 500 Bytes
// Miscellaneous utilities.
import vec::from_fn;
fn convert_rgb32_to_rgb24(buffer: ~[u8]) -> ~[u8] {
let mut i = 0;
do from_fn(buffer.len() * 3 / 4) |j| {
match j % 3 {
0 => {
buffer[i + 2]
}
1 => {
buffer[i + 1]
}
2 => {
let val = buffer[i];
i += 4;
val
}
_ => {
fail
}
}
}
}