Re: [GD-DEVEL] Drawing anti-aliased text with transparent background
[email protected] (Ethan A Merritt)
| Newsgroups | php.gd.devel |
|---|---|
| Organization | University of Washington |
| Message-ID | <[email protected]> |
On Saturday 17 March 2007 11:54, Pierre wrote: > On 3/17/07, Andrei Stebakov <[email protected]> wrote: > > My goal is to create a .png image that has some text on a transparent > > background. > > Here you go: > > and the code: > http://cvs.php.net/viewvc.cgi/gd/playground/text_on_transparent_background/text_aa_alpha.c?revision=1.2&view=markup > > Please remember that it will work for text but not other shapes. The > antialiased lines always blend on the destination pixel, for now. Aha. That explains something that had been bothering me about some plots created by gnuplot. So if the user chooses TrueColor output and a transparent background, then we have to turn off anti-aliasing for vectors. Otherwise there are ghost fringes, which I had noticed but not thought a lot about. I think this is a bug, and should be fixed. The destination pixel in my case is white [usually] with full transparency. When you antialias onto it, the transparency should be taken into account for either setting of gdImageAlphaBlending(), right? But apparently it isn't. As it stands the counter-intuitive observation is that blending two transparent colors produces an opaque result. But only for anti-aliased lines. I'm also puzzled as to why this is true even for pure horizontal or vertical lines. Why are those affected by anti-aliasing at all? I can provide demo output if you like. -- Ethan A Merritt