How to draw text with fade out effect?
How to draw text with fade out effect?
- Subject: How to draw text with fade out effect?
- From: Oleg Krupnov <email@hidden>
- Date: Wed, 28 Jan 2009 17:38:51 +0200
I want to produce the effect of a text string fading out when it's too
long to be displayed in a rect. This kind of effect is used in many
apps.
My first solution was to simply draw the text and then on top of it
draw a gradient fill ranging from the fully transparent color to the
background color of the rect. This works fine, however only for solid
opaque backgrounds.
Now I have the problem that the background is not solid and/or not
opaque. There is no longer such thing as "background color" I could
use in the gradient. How do I solve this problem?
I've tried to go the way of converting the text to a path and fill it
with gradient, but encountered some problems: 1) I don't know the
right line width to stroke the path, I only fill it, and so the path
never looks of the same weight as the simply drawn text; 2) the path
is not aligned to the baseline of text, and I don't know the right
offsets, so the path is never aligned the same way as the simply drawn
text. 3) gradient fill of this path did not produce smooth fade out
for some reason.
I'm hoping there is an easier way I've missed, but any advice is welcome!
_______________________________________________
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