re: ImageAntialias
| From: | Pierre Joye | Date: | Sat, 10 Sep 2005 15:29:37 +0000 |
| Subject: | re: ImageAntialias | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-18761@lists.php.net to get a copy of this message | ||
Hello,
> Not sure if this is best suited for the devel list or the user list, but
> here goes.:
>
> Antialiasing is a basic requirement for generating professional-quality
> pictures. Unfortunately the php-gd function imageantialias needs work.
> Only a small subset of drawing primitives currently make use of
> antialiasing.
Yes, only a small set, the lines, ellipse and circles are coming. They
were ready but not synced with the current GD.
> See http://www.php.net/manual/en/function.imageantialias.php
>
> To quote, "This function is currently not documented; only the argument
> list is available." So there is no documented expected behaviour for
> imageantialias. The only hint of what it can and can't do is in a
> user-contributed comment on the same page (provided by Yours Truly).
> Yet at least one bug report
> http://bugs.php.net/bug.php?id=24798 has
> been marked as 'bogus', although it is at worst is a reasonable feature
> request if not a bug.
Doc can be quicly fixed, "It works only with blending mode, no alpha
channel is used."
> Actually I propose a new method for antialiasing:
>
> bool imageantialias ( resource im, bool on, int MODE )
>
> where MODE is one of:
>
> AA_TRADITIONAL - Perform antialiasing the same way it's done now - that
> is to use a different antialiasing function for each primitive, most of
> which haven't yet been implemented.
It is the only possible way right now. The support for the other
primitives are coming (ellipse, circle soon), the problem is a bit
more complex that you may think. Having the good compromise between
speed and quality is not that easy. Keeping in mind that php is a web
language and not a Adobe Illustrator (c) concurrent, with all the
constraints brought by the web environment (server).
> AA_SCALE - Draw the image to an internal buffer at 2x the requested
> size, using regular non-antialiased primitives, and downscale the result
> to the requested size with bilinear filtering. This produces nice
> antialiased images with very little duplication of code across
> primitives. Line thickness may need to be doubled to give the right effect.
This is horribly slow and ugly. I'm strongly opposed to implement such
thing in ext/gd.
> AA_TEXT - Draw/downsample the image as above, but omit text objects
> until after the image has been downsampled. This allows for clearer but
> non-antialiased text.
I fail to see the usage for that, can you bring some basic examples?
Or are you talking about layers?
Regards,
--Pierre