cvs: gd /libgd ISSUES gd.c /libgd/tests bug00010.c

From: Date: Tue, 10 Oct 2006 00:40:41 +0000
Subject: cvs: gd /libgd ISSUES gd.c /libgd/tests bug00010.c
Groups: php.gd.cvs 
Request: Send a blank email to php-gd-cvs+get-28@lists.php.net to get a copy of this message
pajoye Tue Oct 10 00:40:41 2006 UTC Added files: /gd/libgd/tests bug00010.c Modified files: /gd/libgd gd.c ISSUES Log: - #10, gdImageFilledEllipse does not respect transparency (rewriten) http://cvs.php.net/viewvc.cgi/gd/libgd/gd.c?r1=1.34&r2=1.35&diff_format=u Index: gd/libgd/gd.c diff -u gd/libgd/gd.c:1.34 gd/libgd/gd.c:1.35 --- gd/libgd/gd.c:1.34 Sun Oct 8 21:43:16 2006 +++ gd/libgd/gd.c Tue Oct 10 00:40:41 2006 @@ -1,3 +1,4 @@ +/* $Id: gd.c,v 1.35 2006/10/10 00:40:41 pajoye Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -1576,9 +1577,56 @@ } } -BGD_DECLARE(void) gdImageFilledEllipse (gdImagePtr im, int cx, int cy, int w, int h, int color) +BGD_DECLARE(void) gdImageFilledEllipse (gdImagePtr im, int mx, int my, int w, int h, int c) { - gdImageFilledArc (im, cx, cy, w, h, 0, 360, color, gdPie); + int x=0,mx1=0,mx2=0,my1=0,my2=0; + long aq,bq,dx,dy,r,rx,ry,a,b; + int i; + int old_y1,old_y2; + + a=w>>1; + b=h>>1; + + gdImageLine(im, mx-a, my, mx+a, my, c); + + mx1 = mx-a;my1 = my; + mx2 = mx+a;my2 = my; + + aq = a * a; + bq = b * b; + dx = aq << 1; + dy = bq << 1; + r = a * bq; + rx = r << 1; + ry = 0; + x = a; + old_y2=-2; + old_y1=-2; + while (x > 0){ + if (r > 0) { + my1++;my2--; + ry +=dx; + r -=ry; + } + if (r <= 0){ + x--; + mx1++;mx2--; + rx -=dy; + r +=rx; + } + if(old_y2!=my2){ + for(i=mx1;i<=mx2;i++){ + gdImageSetPixel(im,i,my1,c); + } + } + if(old_y2!=my2){ + for(i=mx1;i<=mx2;i++){ + gdImageSetPixel(im,i,my2,c); + } + } + old_y2 = my2; + old_y1 = my1; + } } BGD_DECLARE(void) gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color) http://cvs.php.net/viewvc.cgi/gd/libgd/ISSUES?r1=1.8&r2=1.9&diff_format=u Index: gd/libgd/ISSUES diff -u gd/libgd/ISSUES:1.8 gd/libgd/ISSUES:1.9 --- gd/libgd/ISSUES:1.8 Mon Oct 9 14:22:22 2006 +++ gd/libgd/ISSUES Tue Oct 10 00:40:41 2006 @@ -26,3 +26,4 @@ RANLIB handling configure.ac: AC_PROG_RANLIB is obsolete, now handled by AC_PROG_LIBTOO +#10, gdImageFilledEllipse does not respect transparency http://cvs.php.net/viewvc.cgi/gd/libgd/tests/bug00010.c?view=markup&rev=1.1 Index: gd/libgd/tests/bug00010.c +++ gd/libgd/tests/bug00010.c /* $Id: bug00010.c,v 1.1 2006/10/10 00:40:41 pajoye Exp $ */ #include "gd.h" int main() { gdImagePtr im; FILE *fp; im = gdImageCreateTrueColor(100,100); gdImageFilledEllipse(im, 50,50, 70, 90, 0x50FFFFFF); fp = fopen("bug00010_out.png", "wb"); gdImagePng(im, fp); fclose(fp); /* Destroy it */ gdImageDestroy(im); return 0; }

« previous php.gd.cvs (#28) next »