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

> Greetings,
> 
> The is probably more of a Carbon question than a Cocoa question, but since 
> the problem starts with CALayer, I'll start here first.

Not really since nothing here involves Carbon :).

> 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.

> 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.
--
David Duncan

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to