• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Working with CGImage and Retina Display
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Working with CGImage and Retina Display
      • From: Steve Christensen <email@hidden>
  • Prev by Date: Re: strategies for working w/ large amounts of text
  • Next by Date: Best practice for receiving data
  • Previous by thread: Re: assign property behaves differently from simple instance variable???
  • Next by thread: Re: Working with CGImage and Retina Display
  • Index(es):
    • Date
    • Thread