Working with CGImage and Retina Display
Working with CGImage and Retina Display
- Subject: Working with CGImage and Retina Display
- From: Gustavo Pizano <email@hidden>
- Date: Tue, 14 Dec 2010 00:09:10 +0100
Hello all.
Im creating some views which draws a CGImage that is obtained from a Atlas Map, (Big map containing all the images).
for iPHone 4 I have this map 2 times bigger than the normal one, so if I have a 2.0 scale on screen I load that one.
What Im getting is that on iPhone 4 Im seeing all the views are drawing the CGImage too big, like 2 times more. So i think this has something to do with the 2.0 scale factor.
what should I do in order to draw the CGImage properly sized?
this is my drawing method which is working on iPad...
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context);
CGContextTranslateCTM(context, 0, CGImageGetHeight(bc_itemImage));
CGContextScaleCTM(context, 1.0, -1.0);
CGContextDrawImage(context, self.bounds, bc_itemImage);
CGContextRestoreGState(context);
and this is my init method
-(id)initWithImageFrame:(CGRect)imgFrame fromSheet:(CGImageRef)sheet{
self = [super initWithFrame:CGRectMake(0, 0, imgFrame.size.width, imgFrame.size.height)];
if(self){
bc_itemImage = CGImageCreateWithImageInRect(sheet,imgFrame);
self.backgroundColor = [UIColor clearColor];
bc_isInBox = YES;
}
return self;
}
Thanks in advance for any help provided.
Gustavo
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden