Reputation: 6852
This is a follow up question to this one.
CATextLayer
can only draw text with sub-pixel antialiasing when opaque.
The text is displayed over a tinted image. The image is tinted with a color 90%, which means that I could basically just ignore the few color differences between the image and the tint color, and antialias against the tint.
Now obviously the background of the CATextLayer
would still have to be transparent.
Unfortunately there is no way to really control sub-pixel AA, you can just disable it or enable it, the rest happens in the background.
I wonder if there is a way to set the anti-alias against a color that is not actually there.
So my question in a sentence:
Is there a way to sub-pixel antialias against a color that is never drawn?
Upvotes: 0
Views: 119
Reputation: 6517
There is a way. (It's a bit of a hack, but since there is no answer yet, after one hour, I thought I should probably post it, although it might not be perfect.)
Render black text onto a white background and save it onto an image.
Then you can render that image with blend mode kCGBlendModeMultiply
using the function -drawInRect:blendMode:alpha:
.
To draw text in other colors you need a bit more image hackery, but it should be possible too, by using the blend modes creatively.
Upvotes: 1