Optimize pixel conversion functions

I've also removed the two helper functions *contextToRgbData* and *rgbDataToContext*, because it makes the code easier to read for me.
Nit: align these operations.