Hoping for some help here from someone with some solid objective c graphics experience. I am trying to build a heat map image and I am having some specific difficulties with color conversion.
The generally recommended approach seems to be to create a grayscale image with ellipses representing the various points on the map. These ellipses have a radial gradient applied to them with the darkest point of the gradient being the center of the ellipse. This part is easy enough to do using the quartz 2d stuff. Where I am struggling is finding a way to take this grayscale image I created and converting it back to a color image with a limited number of colors
So what I really want is to have a grayscale image with varying shades and be able to assign them to a palette of say 64 different colors from blue to dark red to indicate how hot that spot is.
So far the only thing I can see doing is
create a cgcontextref for drawing and draw my ellipses
get a cgimageref using CGBitmapContextCreate
Use that to create a UIImage
Extract the underlying UIImage data into a byte array representing a png or jpg and modify it pixel by pixel.
That seems onerous and it seems like there has to be an easier way to do this perhaps with an indexed image but its not entirely clear to me.
Any ideas?