Hi Guys,
It looks like the image data inside a UIImage object is not retrievable.
I'm wondering if it is possible instead, to copy a UIImage to a bitmap context,
and be able to access the image data from there?
It sounds like something that should be possible, but doesn't appear to be.
Cheers, Art.
----------
Somewhere in there, this rotation function has copied a UIImage to Bitmap context indirectly:
It looks like the image data inside a UIImage object is not retrievable.
I'm wondering if it is possible instead, to copy a UIImage to a bitmap context,
and be able to access the image data from there?
It sounds like something that should be possible, but doesn't appear to be.
Cheers, Art.
----------
Somewhere in there, this rotation function has copied a UIImage to Bitmap context indirectly:
Code:
UIImage *objectImage
CGImageRef imageRef = [self CGImageRotatedByAngle:[objectImage CGImage] angle:(360-rotation)/57.295791];
// dodgy rotation function
- (CGImageRef)CGImageRotatedByAngle:(CGImageRef)imgRef angle:(CGFloat)angle
{
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef bmContext = CGBitmapContextCreate(NULL,1024,1024,8,0,colorSpace,kCGImageAlphaPremultipliedFirst);
CGColorSpaceRelease(colorSpace);
CGContextTranslateCTM(bmContext,+originx,+originy);
CGContextRotateCTM(bmContext, angle);
CGContextTranslateCTM(bmContext,-originx,-originy);
CGContextDrawImage(bmContext, CGRectMake(0,0,1024,1024),imgRef);
rotatedImage = CGBitmapContextCreateImage(bmContext);
CFRelease(bmContext);
return rotatedImage;
}