Ok, so we got the UIImage into a rawBits buffer (see link in original question), then we twiddled the data in the buffer to our liking (i.e., set all the red-components (every 4th byte) to 0, as a test), and now need to get a new UIImage representing the twiddled data.
I found the answer in Erica Sudan's iPhone Cookbook, Chapter 7 (images), example 12 (Bitmaps). The relevant call was CGBitmapContextCreate(), and the relevant code was:
+ (UIImage *) imageWithBits: (unsigned char *) bits withSize: (CGSize)
size
{
// Create a color space
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
if (colorSpace == NULL)
{
fprintf(stderr, "Error allocating color space\n");
free(bits);
return nil;
}
CGContextRef context = CGBitmapContextCreate (bits, size.width,
size.height, 8, size.width * 4, colorSpace,
kCGImageAlphaPremultipliedFirst);
if (context == NULL)
{
fprintf (stderr, "Error: Context not created!");
free (bits);
CGColorSpaceRelease(colorSpace );
return nil;
}
CGColorSpaceRelease(colorSpace );
CGImageRef ref = CGBitmapContextCreateImage(context);
free(CGBitmapContextGetData(context));
CGContextRelease(context);
UIImage *img = [UIImage imageWithCGImage:ref];
CFRelease(ref);
return img;
}
Hope that's useful to future site spelunkers!