Having trouble with CGBitmapContextCreate and getting:
Error: Unsupported pixel description - 1 components, 8 bits-per-component, 8 bits-per-pixel
with this code:
float *bitmap = (float*)malloc(sizeof(float) * width * height);
// fill with floats
CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceGray();
size_t bitsPerComponent = 8;
size_t bytesPerRow = sizeof(float)*width;
CGContextRef context = CGBitmapContextCreate(bitmap, width, height, bitsPerComponent, bytesPerRow, colorspace
, kCGImageAlphaNone| kCGBitmapFloatComponents | kCGBitmapByteOrder32Little);
It's 8 bits per pixel and 8 bits per component. Not sure why I get the error though. I've seen a few other posts here about getting this right but most deal with editing images rather than creating new ones so some of the settings can be taken from the original image.