Re: How to draw text with fade out effect?

2009-02-08 Thread Oleg Krupnov
Wow, Ken! It works like magic (the second method I mean). Thank you very much. I think I would never guess it myself. For those who will reuse this code, don't forget to save/restore the graphics context because CGContextClipToMask modified the clipping region. Sorry for late thanking, I had to

Re: How to draw text with fade out effect?

2009-02-01 Thread Benjamin Dobson
On 29 Jan 2009, at 06:32:45, Kyle Sluder wrote: Perhaps the better solution is to draw the text as normal and then re-draw the background with the appropriate alpha on top. Am I missing something or could you use an NSGradient object to do this?

Re: How to draw text with fade out effect?

2009-02-01 Thread Kyle Sluder
On Sun, Feb 1, 2009 at 4:35 AM, Benjamin Dobson importedfromsp...@googlemail.com wrote: Am I missing something or could you use an NSGradient object to do this? Sure, if you used a gradient or solid color to draw the background in the first place. Just give the starting color an alpha of 0 and

Re: How to draw text with fade out effect?

2009-01-31 Thread Ken Ferry
All else aside, yes you can do this in Cocoa and/or Quartz. Here are a couple different ways. For instruction's sake, here's it done with a compositing operation, NSCompositeDestinationIn. Result color = what's already in the context but with additional alpha taken from the new drawing. -

Re: How to draw text with fade out effect?

2009-01-30 Thread Douglas Davidson
On Jan 29, 2009, at 5:08 PM, Peter N Lewis wrote: One option is to draw the end of the string character by character with varying alphas. Glyph by glyph, really, in the general case. You can take a look at the CircleView example for one case of drawing strings glyph by glyph-- with

Re: How to draw text with fade out effect?

2009-01-29 Thread Oleg Krupnov
Yeah, the question is however how do I technically (e.g. in Cocoa) composite the appropriate alpha with an image, whether the background image, as you suggest, or with text image, as Ricky suggested. AFAIU, there is not such NSCompositingOperation to do this trick. It appears that I need to

Re: How to draw text with fade out effect?

2009-01-29 Thread Rob Keniger
On 29/01/2009, at 6:27 PM, Oleg Krupnov wrote: Yeah, the question is however how do I technically (e.g. in Cocoa) composite the appropriate alpha with an image, whether the background image, as you suggest, or with text image, as Ricky suggested. AFAIU, there is not such

Re: How to draw text with fade out effect?

2009-01-29 Thread matt . gough
On 29 Jan 2009, at 09:33, Rob Keniger wrote: On 29/01/2009, at 6:27 PM, Oleg Krupnov wrote: Yeah, the question is however how do I technically (e.g. in Cocoa) composite the appropriate alpha with an image, whether the background image, as you suggest, or with text image, as Ricky suggested.

Re: How to draw text with fade out effect?

2009-01-29 Thread Peter N Lewis
At 17:38 +0200 28/1/09, Oleg Krupnov 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. One option is to draw the end of the string character by character with varying alphas. Ie, instead of

Re: How to draw text with fade out effect?

2009-01-28 Thread Kyle Sluder
On Wed, Jan 28, 2009 at 10:57 AM, Thomas Davie tom.da...@gmail.com wrote: This solution will also throw sub-pixel anti-aliasing in the bin. Perhaps the better solution is to draw the text as normal and then re-draw the background with the appropriate alpha on top. --Kyle Sluder

Re: How to draw text with fade out effect?

2009-01-28 Thread Quincey Morris
On Jan 28, 2009, at 22:32, Kyle Sluder wrote: On Wed, Jan 28, 2009 at 10:57 AM, Thomas Davie tom.da...@gmail.com wrote: This solution will also throw sub-pixel anti-aliasing in the bin. Perhaps the better solution is to draw the text as normal and then re-draw the background with the