• 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
Re: CGLayer resolution on iPhone with Retina display
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CGLayer resolution on iPhone with Retina display


  • Subject: Re: CGLayer resolution on iPhone with Retina display
  • From: Alex Kac <email@hidden>
  • Date: Sat, 28 Aug 2010 15:37:30 -0500

I believe you need to set the scale of the layer to the scale of the device. Here is how we do it where appContentScaleFactor is a global variable we store the scale from at startup:

	if ([[UIScreen mainScreen] respondsToSelector: @selector(scale)])
		appContentScaleFactor = [[UIScreen mainScreen] scale];


		if ([mainLayer respondsToSelector: @selector(setContentsScale:)])
			mainLayer.contentsScale = appContentScaleFactor;


On Aug 28, 2010, at 3:22 PM, Matt Neuburg wrote:

> In my UIView's drawRect: I derive a CGLayer from the current context, draw
> into it, and then draw the layer into the context (the view). This still
> works on iPhone with a Retina display, but the drawing is blocky. You can
> see the problem perfectly with Apple's own example code (DrawFlag) in the
> CGLayer Drawing page of the Quartz 2D Programming Guide - the stars in the
> flag are blocky.
>
> I can work around the problem for a double-resolution screen by creating a
> CGLayer twice the size I need, applying a doubling scale transform, drawing
> as before into the CGLayer, and then drawing the CGLayer into my view's
> context scaled back down again.
>
> But I feel I shouldn't have to do this. Given that the documentation claims
> that "a CGLayer has all the characteristics of the graphics context [from
> which it is derived] - its resolution, colorspace, and graphics state
> settings," might we call this a bug?
>
> m.
>
> --
> matt neuburg, phd = email@hidden, http://www.tidbits.com/matt/
> pantes anthropoi tou eidenai oregontai phusei
> Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
> AppleScript: the Definitive Guide, 2nd edition
> http://www.tidbits.com/matt/default.html#applescriptthings
> Take Control of Exploring & Customizing Snow Leopard
> http://tinyurl.com/kufyy8
> RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
> TidBITS, Mac news and reviews since 1990, http://www.tidbits.com
>
>
>
> _______________________________________________
>
> 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

Alex Kac - President and Founder
Web Information Solutions, Inc.

"Forgiveness is not an occasional act: it is a permanent attitude."
-- Dr. Martin Luther King




_______________________________________________

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: CGLayer resolution on iPhone with Retina display
      • From: Matt Neuburg <email@hidden>
References: 
 >CGLayer resolution on iPhone with Retina display (From: Matt Neuburg <email@hidden>)

  • Prev by Date: CGLayer resolution on iPhone with Retina display
  • Next by Date: Memory leak when using new MPMoviePlayerController notifications
  • Previous by thread: CGLayer resolution on iPhone with Retina display
  • Next by thread: Re: CGLayer resolution on iPhone with Retina display
  • Index(es):
    • Date
    • Thread