Re: subpixel rendering vs. layer backed views
Re: subpixel rendering vs. layer backed views
- Subject: Re: subpixel rendering vs. layer backed views
- From: Brandon Walkin <email@hidden>
- Date: Sun, 8 Feb 2009 00:29:48 -0500
There are a couple tricks you can use to retain subpixel antialiasing.
If you're giving the view a layer so you can animate it occasionally,
try giving it a layer just before you tell it to animate and removing
the layer once the animation is complete. For quick alpha or origin
changes, the user won't notice the temporary lack of subpixel rendering.
If the view sits on a constant background, then you can retain
subpixel antialiasing while the view is layer backed, provided that it
draws a background. Some views (like text fields, for instance) can be
configured to draw a background color in Interface Builder. Other
views (like the check box you have in your sample project) need to be
subclassed to draw a background. Just override -drawRect:, draw your
background, and call super. Keep in mind, the background you draw
doesn't need to be a flat color. It can be a gradient or some wacky
pattern, as long as it's opaque.
-Brandon
On 7-Feb-09, at 10:36 PM, m wrote:
Is it the case that I can have a layer backed view (and thus nice
animations), or I can have labels and checkboxes whose text is
nicely subpixel anti-aliased, but not both?
I feel like I'm missing something but when I put a check box in a
layer backed view, it looks terrible. It's poorly antialiased and
there is no subpixel rendering.
Demo at <http://muratnkonar.com/source-code/SubpixelOrLayer.zip>
_murat
_______________________________________________
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
_______________________________________________
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