Re: How to draw text with fade out effect?
Re: How to draw text with fade out effect?
- Subject: Re: How to draw text with fade out effect?
- From: Ricky Sharp <email@hidden>
- Date: Wed, 28 Jan 2009 09:49:40 -0600
You could render your text to an image first, composite it with the
opaque-to-transparent mask and finally draw the result.
I used to create images from text, but I ended up with issues
regarding resolution independence for some reason. So, you may need to
test this solution with RI if needed.
Sent from my iPhone
On Jan 28, 2009, at 9:38 AM, Oleg Krupnov <email@hidden>
wrote:
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
_______________________________________________
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