I'm working on obtaining bitmap data like ARGB from an image.
a). I create a bitmapcontext for the image:
context = CGBitmapContextCreate(void * data, size_t width, size_t height, size_t bitsPerComponent, size_t bytesPerRow, CGColorSpaceRef colorspace, CGBitmapInfo bitmapInfo)
b). I draw the image to the context:
CGContextDrawImage(context, rect, imageRef);
c). Then I get data from the bitmapcontext:
void * data = CGBitmapContextGetData(context);
d). void... not readable?
I find that it only returns a void pointer to the image context data which means the data of the context cannot be obtained(writeOnly). Are there any other ways to return the value from the context data?
PS: If I create an unsigned char pointer * data, it will return 240 for RGB and 255 for alpha which are not the correct color components.