Simplifying and speeding up BitmapData.paletteMap