[cl-gd-devel] Antialiased lines, arcs ... don't work, even the test orig pic is wrong...

Edi Weitz edi at agharta.de
Fri Nov 4 01:01:08 UTC 2005


Hi!

On Thu, 3 Nov 2005 05:38:09 -0800 (PST), arry <frinkofox at yahoo.com> wrote:

> I am using CL-GD for over a week now and found out that the
> antialiasing doesn't work at all...  The test, I think was number 4,
> produces the same result as its orig picture in the orig folder, but
> the orig picture in the orig folder is also wrong - there's no
> antialiasing in it...  And this orig pic comes from the package
> itself...
>
> Is this a bug?

Here's the equivalent C code:

  #include "gd.h"

  int main () {
    gdImagePtr im;
    FILE *out;
    int orange, white, red;

    im = gdImageCreate(150, 50);

    orange = gdImageColorAllocate(im, 255, 165, 0);  
    white = gdImageColorAllocate(im, 255, 255, 255);
    red = gdImageColorAllocate(im, 255, 0, 0);  

    gdImageFilledRectangle(im, 50, 0, 99, 49, white);
    gdImageSetThickness(im, 2);
    gdImageLine(im, 5, 10, 145, 10, red);
    gdImageSetAntiAliased(im, red);
    gdImageLine(im, 5, 25, 145, 25, gdAntiAliased);
    gdImageSetAntiAliasedDontBlend(im, red, orange);
    gdImageLine(im, 5, 40, 145, 40, gdAntiAliased);

    out = fopen("/tmp/test.png", "w");
    gdImagePngEx(im, out, 3);
    fclose(out);

    gdImageDestroy(im);
  }

If I run this on my Debian system (with GD being 2.0.33) then diff
says the result is identical to the image produced by CL-GD.  (Note
that the GD documentation for gdImageSetAntiAliasedDontBlend's
signature is wrong, BTW.)

I just re-checked the GD docs and there I find this:

  Drastically faster, less memory-intensive antialiased drawing,
  thanks to Pierre-Alain Joye. This code was imported from the PHP
  "fork" of gd. The API for antialiased drawing has not changed,
  however the implementation has been completely replaced. Antialiased
  line drawing does not support widths other than 1, however this did
  not work properly with the other implementation of antialiasing
  either.

Aha, so this once (kind of) worked in the GD versions I started with
and ceased to work in the meantime.  I should probably change the test
and the examples.

Cheers,
Edi.



More information about the Cl-gd-devel mailing list