void Convert_P_RGBA_8888_To_BGRA_8888(ref byte[] scanLine, byte[] source)
{
byte temp = 0;
byte alpha = 0;
for (int x = 0; x < source.Length; x+=4)
{
alpha = source [x + 3]; // Save off alpha
temp = source [x]; // save off red
if (alpha < 255) {
scanLine [x] = ConversionHelpers.UnpremultiplyValue (alpha, source [x + 2]); // move blue to red
scanLine [x + 1] = ConversionHelpers.UnpremultiplyValue (alpha, source [x + 1]);
scanLine [x + 2] = ConversionHelpers.UnpremultiplyValue (alpha, temp); // move the red to green
} else {
scanLine [x] = source [x + 2]; // move blue to red
scanLine [x + 1] = source [x + 1];
scanLine [x + 2] = temp; // move the red to green
}
// var red = source [x];
// var green = source [x + 1];
// var blue = source [x + 1];
scanLine [x + 3] = alpha;
// Now we do the cha cha cha
}
}