• 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: How to get "colored" font smoothing in a CALayer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get "colored" font smoothing in a CALayer


  • Subject: Re: How to get "colored" font smoothing in a CALayer
  • From: James Bucanek <email@hidden>
  • Date: Thu, 6 Jan 2011 15:51:08 -0700

David Duncan <mailto:email@hidden> wrote (Thursday, January 6, 2011 11:53 AM -0800):

On Jan 6, 2011, at 10:28 AM, James Bucanek wrote:

So how can I get my text to draw as smoothly as the Finder?

Subpixel antialiasing requires a background to antialias against, and your layer is probably transparent. If you supply a background (by drawing one into the context first) then you should get subpixel antialiasing, assuming it is otherwise enabled.

Ah, that's it. Yes, my background is transparent and needs to be transparent (it gets composited over other images), so I guess that's the end of that quest. :(


Searching the forums I found a reference to "sub-pixel smoothing". The
solution was to fix some properties of the CGBitmapContext being drawn into, but CALayer doesn't (as far as I can tell) give you any control
over the CGContext used when drawing the content of the layer.

There is actually a way to gain control over the context that is being drawn into, although this is generally not necessary (and can result in inefficiencies in some cases). Basically you can override -displayLayer: (in your layer's delegate) or -display (in a layer subclass) to create your own bitmap context, call -drawInContext: with that context, then create an image from the context and assign it to the layer's contents property. It isn't a generally useful technique, but if you have a case where you want to preserve previous content when redrawing the layer this is one way to do so.

Thanks very much for that info. Very useful to know, even if I don't need it at this moment.


Cheers!

--
James Bucanek

_______________________________________________

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: How to get "colored" font smoothing in a CALayer
      • From: David Duncan <email@hidden>
References: 
 >Re: How to get "colored" font smoothing in a CALayer (From: David Duncan <email@hidden>)

  • Prev by Date: Troubleshooting CFMessagePort
  • Next by Date: Re: How to get "colored" font smoothing in a CALayer
  • Previous by thread: Re: How to get "colored" font smoothing in a CALayer
  • Next by thread: Re: How to get "colored" font smoothing in a CALayer
  • Index(es):
    • Date
    • Thread