[PHP-CVS] cvs: php-src(PHP_4_3) /ext/gd/libgd gd.c

2005-04-30 Thread Pierre-Alain Joye
pajoye  Sun May  1 01:45:56 2005 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/gd/libgd   gd.c 
  Log:
  - #32891, init old y positions to non possible values. -1 being used if the
center start a (x,0)
  
  
http://cvs.php.net/diff.php/php-src/ext/gd/libgd/gd.c?r1=1.24.2.35r2=1.24.2.36ty=u
Index: php-src/ext/gd/libgd/gd.c
diff -u php-src/ext/gd/libgd/gd.c:1.24.2.35 php-src/ext/gd/libgd/gd.c:1.24.2.36
--- php-src/ext/gd/libgd/gd.c:1.24.2.35 Sat Nov 20 08:34:52 2004
+++ php-src/ext/gd/libgd/gd.c   Sun May  1 01:45:55 2005
@@ -1737,8 +1737,8 @@
rx = r  1;
ry = 0;
x = a;
-   old_y2=-1;
-   old_y1=-1;
+   old_y2=-2;
+   old_y1=-2;
while (x  0){
if (r  0) {
my1++;my2--;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/gd/libgd gd.c

2004-11-20 Thread Pierre-Alain Joye
pajoye  Sat Nov 20 08:34:53 2004 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/gd/libgd   gd.c 
  Log:
  - Fix #30229, imagerectangle draw the corners twice, making it useless
with alpha channel.
Fix it to work well with thick1 as well, both filled and wired rectangle
  
  
http://cvs.php.net/diff.php/php-src/ext/gd/libgd/gd.c?r1=1.24.2.34r2=1.24.2.35ty=u
Index: php-src/ext/gd/libgd/gd.c
diff -u php-src/ext/gd/libgd/gd.c:1.24.2.34 php-src/ext/gd/libgd/gd.c:1.24.2.35
--- php-src/ext/gd/libgd/gd.c:1.24.2.34 Wed Nov 17 12:13:42 2004
+++ php-src/ext/gd/libgd/gd.c   Sat Nov 20 08:34:52 2004
@@ -2029,24 +2029,72 @@
 {
int x1h = x1, x1v = x1, y1h = y1, y1v = y1, x2h = x2, x2v = x2, y2h = 
y2, y2v = y2;
int thick = im-thick;
+   int half1 = 1;
+   int t;
 
+   if (y2  y1) {
+   t=y1;
+   y1 = y2;
+   y2 = t;
+
+   t = x1;
+   x1 = x2;
+   x2 = t;
+   }
+
+   x1h = x1; x1v = x1; y1h = y1; y1v = y1; x2h = x2; x2v = x2; y2h = y2; 
y2v = y2;
if (thick  1) {
-   int half = thick / 2;
-   int half1 = thick - half;
+   int cx, cy, x1ul, y1ul, x2lr, y2lr;
+   int half = thick  1;
+   half1 = thick - half;
+   x1ul = x1 - half;
+   y1ul = y1 - half;
+   
+   x2lr = x2 + half;
+   y2lr = y2 + half;
 
-   if (y1  y2) {
-   y1v = y1h - half;
-   y2v = y2h + half1 - 1;
-   } else {
-   y1v = y1h + half1 - 1;
-   y2v = y2h - half;
+   cy = y1ul + thick;
+   while (cy--  y1ul) {
+   cx = x1ul - 1;
+   while (cx++  x2lr) {
+   gdImageSetPixel(im, cx, cy, color);
+   }
}
+
+   cy = y2lr - thick;
+   while (cy++  y2lr) {
+   cx = x1ul - 1;
+   while (cx++  x2lr) {
+   gdImageSetPixel(im, cx, cy, color);
+   }
+   }
+
+   cy = y1ul + thick - 1;
+   while (cy++  y2lr -thick) {
+   cx = x1ul - 1;
+   while (cx++  x1ul + thick) {
+   gdImageSetPixel(im, cx, cy, color);
+   }
+   }
+
+   cy = y1ul + thick - 1;
+   while (cy++  y2lr -thick) {
+   cx = x2lr - thick - 1;
+   while (cx++  x2lr) {
+   gdImageSetPixel(im, cx, cy, color);
+   }
+   }
+
+   return;
+   } else {
+   y1v = y1h + 1;
+   y2v = y2h - 1;
+   gdImageLine(im, x1h, y1h, x2h, y1h, color);
+   gdImageLine(im, x1h, y2h, x2h, y2h, color);
+   gdImageLine(im, x1v, y1v, x1v, y2v, color);
+   gdImageLine(im, x2v, y1v, x2v, y2v, color);
}
 
-   gdImageLine(im, x1h, y1h, x2h, y1h, color);
-   gdImageLine(im, x1h, y2h, x2h, y2h, color);
-   gdImageLine(im, x1v, y1v, x1v, y2v, color);
-   gdImageLine(im, x2v, y1v, x2v, y2v, color);
 }
 
 void gdImageFilledRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, 
int color)
@@ -2069,6 +2117,16 @@
if (y1  gdImageSY(im)) {
y1 = gdImageSY(im);
}
+   if (y2  y1) {
+   int t;
+   t=y1;
+   y1 = y2;
+   y2 = t;
+
+   t = x1;
+   x1 = x2;
+   x2 = t;
+   }
 
for (y = y1; (y = y2); y++) {
for (x = x1; (x = x2); x++) {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/gd/libgd gd.c /ext/gd/tests bug28984.phpt

2004-07-03 Thread Pierre-Alain Joye
pajoye  Sat Jul  3 11:32:33 2004 EDT

  Added files: (Branch: PHP_4_3)
/php-src/ext/gd/tests   bug28984.phpt 

  Modified files:  
/php-src/ext/gd/libgd   gd.c 
  Log:
  - Fix #28984, using full transparent segfauls in imagefill
(NB: imagefill is broken in HEAD, same code)
  - Add testcase
  
  
http://cvs.php.net/diff.php/php-src/ext/gd/libgd/gd.c?r1=1.24.2.32r2=1.24.2.33ty=u
Index: php-src/ext/gd/libgd/gd.c
diff -u php-src/ext/gd/libgd/gd.c:1.24.2.32 php-src/ext/gd/libgd/gd.c:1.24.2.33
--- php-src/ext/gd/libgd/gd.c:1.24.2.32 Mon May 24 16:03:08 2004
+++ php-src/ext/gd/libgd/gd.c   Sat Jul  3 11:32:33 2004
@@ -1879,13 +1879,18 @@
int l, x1, x2, dy;
int oc;   /* old pixel value */
int wx2,wy2;
+   int alphablending_bak;
/* stack of filled segments */
/* struct seg stack[FILL_MAX],*sp = stack;; */
struct seg *stack;
struct seg *sp;
 
+   alphablending_bak = im-alphaBlendingFlag;  
+   im-alphaBlendingFlag = 0;
+
if (nc==gdTiled){
_gdImageFillTiled(im,x,y,nc);
+   im-alphaBlendingFlag = alphablending_bak;  
return;
}
 
@@ -1931,6 +1936,7 @@
} while (x=x2);
}
efree(stack);
+   im-alphaBlendingFlag = alphablending_bak;  
 }
 
 void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc)

http://cvs.php.net/co.php/php-src/ext/gd/tests/bug28984.phpt?r=1.1p=1
Index: php-src/ext/gd/tests/bug28984.phpt
+++ php-src/ext/gd/tests/bug28984.phpt

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/gd/libgd gd.c

2004-04-27 Thread Ilia Alshanetsky
iliaa   Tue Apr 27 10:59:26 2004 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/gd/libgd   gd.c 
  Log:
  MFH: Fixed bug #28184 (C++ comments in GD library sources).
  
  
http://cvs.php.net/diff.php/php-src/ext/gd/libgd/gd.c?r1=1.24.2.30r2=1.24.2.31ty=u
Index: php-src/ext/gd/libgd/gd.c
diff -u php-src/ext/gd/libgd/gd.c:1.24.2.30 php-src/ext/gd/libgd/gd.c:1.24.2.31
--- php-src/ext/gd/libgd/gd.c:1.24.2.30 Sun Apr 25 15:43:30 2004
+++ php-src/ext/gd/libgd/gd.c   Tue Apr 27 10:59:25 2004
@@ -1875,7 +1875,7 @@
int oc;   /* old pixel value */
int wx2,wy2;
/* stack of filled segments */
-   //struct seg stack[FILL_MAX],*sp = stack;;
+   /* struct seg stack[FILL_MAX],*sp = stack;; */
struct seg *stack;
struct seg *sp;
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/gd/libgd gd.c

2004-03-17 Thread Pierre-Alain Joye
pajoye  Wed Mar 17 12:25:25 2004 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/gd/libgd   gd.c 
  Log:
  - MFH (crash in imagecolortransparent with invalid color index)
  
  
http://cvs.php.net/diff.php/php-src/ext/gd/libgd/gd.c?r1=1.24.2.26r2=1.24.2.27ty=u
Index: php-src/ext/gd/libgd/gd.c
diff -u php-src/ext/gd/libgd/gd.c:1.24.2.26 php-src/ext/gd/libgd/gd.c:1.24.2.27
--- php-src/ext/gd/libgd/gd.c:1.24.2.26 Sat Mar 13 19:46:45 2004
+++ php-src/ext/gd/libgd/gd.c   Wed Mar 17 12:25:24 2004
@@ -571,7 +571,7 @@
if (im-transparent != -1) {
im-alpha[im-transparent] = gdAlphaOpaque;
}
-   if (color  -1  color=gdMaxColors) {
+   if (color  -1  colorim-colorsTotal  color=gdMaxColors) {
im-alpha[color] = gdAlphaTransparent;
} else {
return;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/gd/libgd gd.c /ext/gd/tests bug27582_1.phpt bug27582_2.phpt

2004-03-13 Thread Pierre-Alain Joye
pajoye  Sat Mar 13 18:36:30 2004 EDT

  Added files: (Branch: PHP_4_3)
/php-src/ext/gd/tests   bug27582_1.phpt bug27582_2.phpt 

  Modified files:  
/php-src/ext/gd/libgd   gd.c 
  Log:
  - MFH bug #27582 (imagefilltoborder crashes)
  
  
http://cvs.php.net/diff.php/php-src/ext/gd/libgd/gd.c?r1=1.24.2.24r2=1.24.2.25ty=u
Index: php-src/ext/gd/libgd/gd.c
diff -u php-src/ext/gd/libgd/gd.c:1.24.2.24 php-src/ext/gd/libgd/gd.c:1.24.2.25
--- php-src/ext/gd/libgd/gd.c:1.24.2.24 Thu Dec 25 17:33:03 2003
+++ php-src/ext/gd/libgd/gd.c   Sat Mar 13 18:36:28 2004
@@ -1769,6 +1769,11 @@
return;
}
 
+   if (im-alphaBlendingFlag) {
+   restoreAlphaBleding = 1;
+   im-alphaBlendingFlag = 0;
+   }
+
if (x = im-sx) {
x = im-sx - 1;
}
@@ -1784,6 +1789,9 @@
leftLimit = i;
}
if (leftLimit == -1) {
+   if (restoreAlphaBleding) {
+   im-alphaBlendingFlag = 1;
+   }
return;
}
/* Seek right */
@@ -1827,6 +1835,9 @@
}
}
}
+   if (restoreAlphaBleding) {
+   im-alphaBlendingFlag = 1;
+   }
 }
 
 

http://cvs.php.net/co.php/php-src/ext/gd/tests/bug27582_1.phpt?r=1.1p=1
Index: php-src/ext/gd/tests/bug27582_1.phpt
+++ php-src/ext/gd/tests/bug27582_1.phpt

http://cvs.php.net/co.php/php-src/ext/gd/tests/bug27582_2.phpt?r=1.1p=1
Index: php-src/ext/gd/tests/bug27582_2.phpt
+++ php-src/ext/gd/tests/bug27582_2.phpt
--TEST--
Bug #24594 (Filling an area using tiles).
--SKIPIF--
?php
if (!extension_loaded('gd')) {
die(skip gd extension not available\n);
}
if (!GD_BUNDLED) {
die('skip external GD libraries may fail');
}
?
--FILE--
?php
/* $id */
/*
 * This test segfaults with the current imagefilltoborder
 * implementation. A rewrite of this function is required 
 * to fix it. The algorithm used in gdImageFill (and the
 * privat function for tiled fill) may help here. pierre.
 */
$tile = imagecreate(36,36);
$base = imagecreate(150,150);
$white = imagecolorallocate($tile,255,255,255);
$black = imagecolorallocate($tile,0,0,0);
$white = imagecolorallocate($base,255,255,255);
$black = imagecolorallocate($base,0,0,0);

/* create the dots pattern */
for ($x=0;$x36;$x+=2) {
for ($y=0;$y36;$y+=2) {
imagesetpixel($tile,$x,$y,$black);
}
}

imagesettile($base,$tile);
imagerectangle($base, 9,9,139,139,$black);
imageline($base, 9,9,139,139,$black);
imagefill($base,11,12,IMG_COLOR_TILED);

$res = imagecolorat($base,0,10)==$black?'1':'0';
$res .= imagecolorat($base,0,20)==$black?'1':'0';
$res .= imagecolorat($base,0,30)==$black?'1':'0';
$res .= imagecolorat($base,0,40)==$black?'1':'0';
$res .= imagecolorat($base,0,50)==$black?'1':'0';
$res .= imagecolorat($base,0,60)==$black?'1':'0';

$res .= imagecolorat($base,11,12)==$white?'1':'0';
$res .= imagecolorat($base,12,13)==$white?'1':'0';
$res .= imagecolorat($base,13,14)==$white?'1':'0';
$res .= imagecolorat($base,14,15)==$white?'1':'0';
$res .= imagecolorat($base,15,16)==$white?'1':'0';
$res .= imagecolorat($base,16,17)==$white?'1':'0';

$res .= imagecolorat($base,10,12)==$black?'1':'0';
$res .= imagecolorat($base,11,13)==$black?'1':'0';
$res .= imagecolorat($base,12,14)==$black?'1':'0';
$res .= imagecolorat($base,13,15)==$black?'1':'0';
$res .= imagecolorat($base,14,16)==$black?'1':'0';
$res .= imagecolorat($base,15,17)==$black?'1':'0';
echo $res\n;

imagefilledrectangle($base,0,0,149,149,$white);
imagerectangle($base, 9,9,139,139,$black);
imageline($base, 9,9,139,139,$black);
imagefilltoborder($base,0,0,$black,IMG_COLOR_TILED);

$res = imagecolorat($base,0,10)==$black?'1':'0';
$res .= imagecolorat($base,0,20)==$black?'1':'0';
$res .= imagecolorat($base,0,30)==$black?'1':'0';
$res .= imagecolorat($base,0,40)==$black?'1':'0';
$res .= imagecolorat($base,0,50)==$black?'1':'0';
$res .= imagecolorat($base,0,60)==$black?'1':'0';

$res .= imagecolorat($base,11,12)==$white?'1':'0';
$res .= imagecolorat($base,12,13)==$white?'1':'0';
$res .= imagecolorat($base,13,14)==$white?'1':'0';
$res .= imagecolorat($base,14,15)==$white?'1':'0';
$res .= imagecolorat($base,15,16)==$white?'1':'0';
$res .= imagecolorat($base,16,17)==$white?'1':'0';

$res .= imagecolorat($base,0,16)==$black?'1':'0';
$res .= imagecolorat($base,2,42)==$black?'1':'0';
$res .= imagecolorat($base,4,44)==$black?'1':'0';
$res 

[PHP-CVS] cvs: php-src(PHP_4_3) /ext/gd/libgd gd.c

2004-03-13 Thread Pierre-Alain Joye
pajoye  Sat Mar 13 19:46:48 2004 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/gd/libgd   gd.c 
  Log:
  - missing restoreAlphaBleding declaration
  
  
http://cvs.php.net/diff.php/php-src/ext/gd/libgd/gd.c?r1=1.24.2.25r2=1.24.2.26ty=u
Index: php-src/ext/gd/libgd/gd.c
diff -u php-src/ext/gd/libgd/gd.c:1.24.2.25 php-src/ext/gd/libgd/gd.c:1.24.2.26
--- php-src/ext/gd/libgd/gd.c:1.24.2.25 Sat Mar 13 18:36:28 2004
+++ php-src/ext/gd/libgd/gd.c   Sat Mar 13 19:46:45 2004
@@ -1762,7 +1762,7 @@
int lastBorder;
/* Seek left */
int leftLimit = -1, rightLimit;
-   int i;
+   int i, restoreAlphaBleding=0;
 
if (border  0) {
/* Refuse to fill to a non-solid border */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/gd/libgd gd.c

2003-07-30 Thread Ilia Alshanetsky
iliaa   Wed Jul 30 13:34:23 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/gd/libgd   gd.c 
  Log:
  MFH: Fixed bug #23792 (8 bit graphics don't rotate properly)
  
  
Index: php-src/ext/gd/libgd/gd.c
diff -u php-src/ext/gd/libgd/gd.c:1.24.2.20 php-src/ext/gd/libgd/gd.c:1.24.2.21
--- php-src/ext/gd/libgd/gd.c:1.24.2.20 Wed Jul 23 11:37:14 2003
+++ php-src/ext/gd/libgd/gd.c   Wed Jul 30 13:34:23 2003
@@ -2475,7 +2475,7 @@
f = gdImageGetTrueColorPixel;
} else {
pxlOldLeft = clrBack;
-   clrBackR = gdImageRed(src, clrBack); 
+   clrBackR = gdImageRed(src, clrBack);
clrBackG = gdImageGreen(src, clrBack);
clrBackB = gdImageBlue(src, clrBack);
clrBackA = gdImageAlpha(src, clrBack);
@@ -2500,30 +2500,30 @@
a = (int)(gdImageAlpha(src,pxlSrc) * dWeight);
 
pxlLeft = gdImageColorAllocateAlpha(src, r, g, b, a);
-   
+
if (pxlLeft == -1) {
pxlLeft = gdImageColorClosestAlpha(src, r, g, b, a);
}
-   
+
r = gdImageRed(src,pxlSrc) - (gdImageRed(src,pxlLeft) - 
gdImageRed(src,pxlOldLeft));
g = gdImageGreen(src,pxlSrc) - (gdImageGreen(src,pxlLeft) - 
gdImageGreen(src,pxlOldLeft));
b = gdImageBlue(src,pxlSrc) - (gdImageBlue(src,pxlLeft) - 
gdImageBlue(src,pxlOldLeft));
a = gdImageAlpha(src,pxlSrc) - (gdImageAlpha(src,pxlLeft) - 
gdImageAlpha(src,pxlOldLeft));
 
-   if (r255) {
-   r = 255;
-   }
-   
+if (r255) {
+   r = 255;
+}
+
if (g255) {
g = 255;
-   }   
-   
-   if(b255) {
-   b = 255;
-   }
-   
+   }
+
+   if (b255) {
+   b = 255;
+   }
+
if (a127) {
-   b = 127;
+   a = 127;
}
 
pxlSrc = gdImageColorAllocateAlpha(dst, r, g, b, a);
@@ -2540,7 +2540,7 @@
}
 
i += iOffset;
-   
+
if (i  dst-sx) {
gdImageSetPixel (dst, i, uRow, pxlLeft);
}
@@ -2567,46 +2567,50 @@
f = gdImageGetPixel;
}
 
-   for (i = 0; iiOffset; i++) {
+   for (i = 0; i=iOffset; i++) {
gdImageSetPixel (dst, uCol, i, clrBack);
}
+   r = (int)((double)gdImageRed(src,clrBack) * dWeight);
+   g = (int)((double)gdImageGreen(src,clrBack) * dWeight);
+   b = (int)((double)gdImageBlue(src,clrBack) * dWeight);
+   a = (int)((double)gdImageAlpha(src,clrBack) * dWeight);
 
-   pxlOldLeft = clrBack;
+   pxlOldLeft = gdImageColorAllocateAlpha(dst, r, g, b, a);
 
for (i = 0; i  src-sy; i++) {
pxlSrc = f (src, uCol, i);
iYPos = i + iOffset;
 
-   r = (int)(gdImageRed(src,pxlSrc) * dWeight);
-   g = (int)(gdImageGreen(src,pxlSrc) * dWeight);
-   b = (int)(gdImageBlue(src,pxlSrc) * dWeight);
-   a = (int)(gdImageAlpha(src,pxlSrc) * dWeight);
-   
+   r = (int)((double)gdImageRed(src,pxlSrc) * dWeight);
+   g = (int)((double)gdImageGreen(src,pxlSrc) * dWeight);
+   b = (int)((double)gdImageBlue(src,pxlSrc) * dWeight);
+   a = (int)((double)gdImageAlpha(src,pxlSrc) * dWeight);
+
pxlLeft = gdImageColorAllocateAlpha(src, r, g, b, a);
-   
+
if (pxlLeft == -1) {
pxlLeft = gdImageColorClosestAlpha(src, r, g, b, a);
}
 
-   r = gdImageRed(src,pxlSrc) - (gdImageRed(src,pxlLeft) - 
gdImageRed(src,pxlOldLeft));
+   r = gdImageRed(src,pxlSrc) - (gdImageRed(src,pxlLeft) - 
gdImageRed(src,pxlOldLeft));
g = gdImageGreen(src,pxlSrc) - (gdImageGreen(src,pxlLeft) - 
gdImageGreen(src,pxlOldLeft));
b = gdImageBlue(src,pxlSrc) - (gdImageBlue(src,pxlLeft) - 
gdImageBlue(src,pxlOldLeft));
a = gdImageAlpha(src,pxlSrc) - (gdImageAlpha(src,pxlLeft) - 
gdImageAlpha(src,pxlOldLeft));
-   
+
if (r255) {
r = 255;
-   }
-   
+   }
+
if (g255) {
g = 255;
-   }   
-   
-   if(b255) {
-   b = 255;
-   }
-   
+   }
+
+   if (b255) {
+   b = 255;
+   }
+
if (a127) {
-   b = 127;
+   a = 127;
}
 
pxlSrc = gdImageColorAllocateAlpha(dst, r, g, b, a);
@@ -2618,7 +2622,7 @@

[PHP-CVS] cvs: php-src(PHP_4_3) /ext/gd/libgd gd.c

2003-07-09 Thread Pierre-Alain Joye
pajoye  Wed Jul  9 06:38:22 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/gd/libgd   gd.c 
  Log:
  - MFH
  
  
Index: php-src/ext/gd/libgd/gd.c
diff -u php-src/ext/gd/libgd/gd.c:1.24.2.16 php-src/ext/gd/libgd/gd.c:1.24.2.17
--- php-src/ext/gd/libgd/gd.c:1.24.2.16 Wed Jul  2 07:33:35 2003
+++ php-src/ext/gd/libgd/gd.c   Wed Jul  9 06:38:22 2003
@@ -2547,7 +2547,7 @@
dst = gdImageCreate (src-sy, src-sx);
f = gdImageGetPixel;
}
-
+   dst = gdImageCreateTrueColor(src-sy, src-sx);
if (dst != NULL) {
gdImagePaletteCopy (dst, src);

@@ -2572,13 +2572,11 @@
FuncPtr f;
 
if (src-trueColor) {
-   dst = gdImageCreateTrueColor ( src-sx,src-sy);
f = gdImageGetTrueColorPixel;
} else {
-   dst = gdImageCreate (src-sx, src-sy);
f = gdImageGetPixel;
}
-
+   dst = gdImageCreateTrueColor(src-sx, src-sy);
if (dst != NULL) {
gdImagePaletteCopy (dst, src);

@@ -2603,12 +2601,11 @@
FuncPtr f;
 
if (src-trueColor) {
-   dst = gdImageCreateTrueColor (src-sy, src-sx);
f = gdImageGetTrueColorPixel;
} else {
-   dst = gdImageCreate (src-sy, src-sx);
f = gdImageGetPixel;
}
+   dst = gdImageCreateTrueColor(src-sy, src-sx);
 
if (dst != NULL) {
gdImagePaletteCopy (dst, src);
@@ -2643,12 +2640,11 @@
 
/* 1st shear */
if (src-trueColor) {
-   dst1 = gdImageCreateTrueColor (newx, newy);
f = gdImageGetTrueColorPixel;
} else {
-   dst1 = gdImageCreate (newx, newy);
f = gdImageGetPixel;
}
+   dst1 = gdImageCreateTrueColor(newx, newy);
 
/*** Perform 1st shear (horizontal) **/
if (dst1 == NULL) {
@@ -2749,6 +2745,11 @@
if (src == NULL) {
return NULL;
}
+
+   if (!gdImageTrueColor(src)  clrBack=gdImageColorsTotal(src)) {
+   return NULL;
+   }
+
 
while (dAngle = 360.0) {
dAngle -= 360.0;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/gd/libgd gd.c

2003-07-09 Thread Pierre-Alain Joye
pajoye  Wed Jul  9 06:43:01 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/gd/libgd   gd.c 
  Log:
  - MFH
  
  
Index: php-src/ext/gd/libgd/gd.c
diff -u php-src/ext/gd/libgd/gd.c:1.24.2.17 php-src/ext/gd/libgd/gd.c:1.24.2.18
--- php-src/ext/gd/libgd/gd.c:1.24.2.17 Wed Jul  9 06:38:22 2003
+++ php-src/ext/gd/libgd/gd.c   Wed Jul  9 06:43:01 2003
@@ -2075,9 +2075,9 @@
} else {
dc = gdImageGetPixel(dst, tox, toy);
 
-   ncR = (int)gdImageRed (src, c) * (pct / 100.0) + 
gdImageRed (dst, dc) * ((100 - pct) / 100.0);
-   ncG = (int)gdImageGreen (src, c) * (pct / 100.0) + 
(int)gdImageGreen (dst, dc) * ((100 - pct) / 100.0);
-   ncB = (int)gdImageBlue (src, c) * (pct / 100.0) + 
gdImageBlue (dst, dc) * ((100 - pct) / 100.0);
+   ncR = (int)(gdImageRed (src, c) * (pct / 100.0) + 
gdImageRed (dst, dc) * ((100 - pct) / 100.0));
+   ncG = (int)(gdImageGreen (src, c) * (pct / 100.0) + 
gdImageGreen (dst, dc) * ((100 - pct) / 100.0));
+   ncB = (int)(gdImageBlue (src, c) * (pct / 100.0) + 
gdImageBlue (dst, dc) * ((100 - pct) / 100.0));
 
/* Find a reasonable color */
nc = gdImageColorResolve (dst, ncR, ncG, ncB);
@@ -2368,14 +2368,22 @@
 void gdImageSkewX (gdImagePtr dst, gdImagePtr src, int uRow, int iOffset, double 
dWeight, int clrBack)
 {
typedef int (*FuncPtr)(gdImagePtr, int, int);
-   int i, r, g, b, a;
+   int i, r, g, b, a, clrBackR, clrBackG, clrBackB, clrBackA;
FuncPtr f;
 
int pxlOldLeft, pxlLeft=0, pxlSrc;
 
+   /* Keep clrBack as color index if required */
if (src-trueColor) {
+   pxlOldLeft = clrBack;
f = gdImageGetTrueColorPixel;
} else {
+   pxlOldLeft = clrBack;
+   clrBackR = gdImageRed(src, clrBack); 
+   clrBackG = gdImageGreen(src, clrBack);
+   clrBackB = gdImageBlue(src, clrBack);
+   clrBackA = gdImageAlpha(src, clrBack);
+   clrBack =  gdTrueColorAlpha(clrBackR, clrBackG, clrBackB, clrBackA);
f = gdImageGetPixel;
}
 
@@ -2387,8 +2395,6 @@
gdImageSetPixel (dst, i, uRow, clrBack);
}
 
-   pxlOldLeft  = clrBack;
-
for (i = 0; i  src-sx; i++) {
pxlSrc = f (src,i,uRow);
 
@@ -2541,10 +2547,8 @@
FuncPtr f;
 
if (src-trueColor) {
-   dst = gdImageCreateTrueColor(src-sy, src-sx);
f = gdImageGetTrueColorPixel;
} else {
-   dst = gdImageCreate (src-sy, src-sx);
f = gdImageGetPixel;
}
dst = gdImageCreateTrueColor(src-sy, src-sx);
@@ -2629,6 +2633,7 @@
double dRadAngle, dSinE, dTan, dShear;
double dOffset; /* Variable skew offset */
int u, iShear, newx, newy;
+   int clrBackR, clrBackG, clrBackB, clrBackA;
 
/* See GEMS I for the algorithm details */
dRadAngle = dAngle * ROTATE_DEG2RAD; /* Angle in radians */
@@ -2658,6 +2663,7 @@
}

gdImagePaletteCopy (dst1, src);
+
dRadAngle = dAngle * ROTATE_DEG2RAD; /* Angle in radians */
dSinE = sin (dRadAngle);
dTan = tan (dRadAngle / 2.0);
@@ -2674,6 +2680,15 @@
gdImageSkewX(dst1, src, u, iShear, (dShear - iShear), clrBack);
}
 
+   /*
+   The 1st shear may use the original clrBack as color index
+   Convert it once here
+   */
+   clrBackR = gdImageRed(src, clrBack); 
+   clrBackG = gdImageGreen(src, clrBack);
+   clrBackB = gdImageBlue(src, clrBack);
+   clrBackA = gdImageAlpha(src, clrBack);
+   clrBack =  gdTrueColorAlpha(clrBackR, clrBackG, clrBackB, clrBackA);
/* 2nd shear */
newx = dst1-sx;

@@ -2686,13 +2701,11 @@
newy = (int) ((double) src-sx * fabs( dSinE ) + (double) src-sy * cos 
(dRadAngle));
 
if (src-trueColor) {
-   dst2 = gdImageCreateTrueColor (newx, newy);
f = gdImageGetTrueColorPixel;
} else {
-   dst2 = gdImageCreate (newx, newy);
f = gdImageGetPixel;
}
-
+   dst2 = gdImageCreateTrueColor(newx, newy);
if (dst2 == NULL) {
gdImageDestroy(dst1);
return NULL;
@@ -2710,13 +2723,11 @@
newy = dst2-sy;
 
if (src-trueColor) {
-   dst3 = gdImageCreateTrueColor (newx, newy);
f = gdImageGetTrueColorPixel;
} else {
-   dst3 = gdImageCreate (newx, newy);
f = gdImageGetPixel;
}
-   
+   dst3 = gdImageCreateTrueColor(newx, newy);  
if (dst3 == NULL) {
gdImageDestroy(dst2);
 

[PHP-CVS] cvs: php-src(PHP_4_3) /ext/gd/libgd gd.c

2003-07-09 Thread Pierre-Alain Joye
pajoye  Wed Jul  9 20:11:11 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/gd/libgd   gd.c 
  Log:
  - MFH
  
  
Index: php-src/ext/gd/libgd/gd.c
diff -u php-src/ext/gd/libgd/gd.c:1.24.2.18 php-src/ext/gd/libgd/gd.c:1.24.2.19
--- php-src/ext/gd/libgd/gd.c:1.24.2.18 Wed Jul  9 06:43:01 2003
+++ php-src/ext/gd/libgd/gd.c   Wed Jul  9 20:11:11 2003
@@ -2541,7 +2541,7 @@
 gdImagePtr gdImageRotate90 (gdImagePtr src)
 {
int uY, uX;
-   int c;
+   int c, r,g,b,a;
gdImagePtr dst;
typedef int (*FuncPtr)(gdImagePtr, int, int);
FuncPtr f;
@@ -2552,12 +2552,20 @@
f = gdImageGetPixel;
}
dst = gdImageCreateTrueColor(src-sy, src-sx);
+
if (dst != NULL) {
gdImagePaletteCopy (dst, src);

for (uY = 0; uYsrc-sy; uY++) {
for (uX = 0; uXsrc-sx; uX++) {
c = f (src, uX, uY);
+   if (!src-trueColor) {
+   r = gdImageRed(src,c);
+   g = gdImageGreen(src,c);
+   b = gdImageBlue(src,c);
+   a = gdImageAlpha(src,c);
+   c = gdTrueColorAlpha(r, g, b, a);
+   }
gdImageSetPixel(dst, uY, (dst-sy - uX - 1), c);
}
}
@@ -2570,7 +2578,7 @@
 gdImagePtr gdImageRotate180 (gdImagePtr src)
 {
int uY, uX;
-   int c;
+   int c,r,g,b,a;
gdImagePtr dst;
typedef int (*FuncPtr)(gdImagePtr, int, int);
FuncPtr f;
@@ -2581,12 +2589,20 @@
f = gdImageGetPixel;
}
dst = gdImageCreateTrueColor(src-sx, src-sy);
+
if (dst != NULL) {
gdImagePaletteCopy (dst, src);

for (uY = 0; uYsrc-sy; uY++) {
for (uX = 0; uXsrc-sx; uX++) {
c = f (src, uX, uY);
+   if (!src-trueColor) {
+   r = gdImageRed(src,c);
+   g = gdImageGreen(src,c);
+   b = gdImageBlue(src,c);
+   a = gdImageAlpha(src,c);
+   c = gdTrueColorAlpha(r, g, b, a);
+   }
gdImageSetPixel(dst, (dst-sx - uX - 1), (dst-sy - uY 
- 1), c);
}
}
@@ -2599,7 +2615,7 @@
 gdImagePtr gdImageRotate270 ( gdImagePtr src )
 {
int uY, uX;
-   int c;
+   int c,r,g,b,a;
gdImagePtr dst;
typedef int (*FuncPtr)(gdImagePtr, int, int);
FuncPtr f;
@@ -2617,6 +2633,13 @@
for (uY = 0; uYsrc-sy; uY++) {
for (uX = 0; uXsrc-sx; uX++) {
c = f (src, uX, uY);
+   if (!src-trueColor) {
+   r = gdImageRed(src,c);
+   g = gdImageGreen(src,c);
+   b = gdImageBlue(src,c);
+   a = gdImageAlpha(src,c);
+   c = gdTrueColorAlpha(r, g, b, a);
+   }
gdImageSetPixel(dst, (dst-sx - uY - 1), uX, c);
}
}



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/gd/libgd gd.c

2003-07-02 Thread Pierre-Alain Joye
pajoye  Wed Jul  2 07:24:52 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/gd/libgd   gd.c 
  Log:
  - MFH
  
  
Index: php-src/ext/gd/libgd/gd.c
diff -u php-src/ext/gd/libgd/gd.c:1.24.2.14 php-src/ext/gd/libgd/gd.c:1.24.2.15
--- php-src/ext/gd/libgd/gd.c:1.24.2.14 Thu Jun 12 15:33:19 2003
+++ php-src/ext/gd/libgd/gd.c   Wed Jul  2 07:24:52 2003
@@ -2075,9 +2075,12 @@
} else {
dc = gdImageGetPixel(dst, tox, toy);
 
-   ncR = (int)(gdImageRed (src, c) * (pct / 100.0f) + 
((100 - pct) / 100.0f));
-   ncG = (int)(gdImageGreen (src, c) * (pct / 100.0f) + 
((100 - pct) / 100.0f));
-   ncB = (int)(gdImageBlue (src, c) * (pct / 100.0f) + 
((100 - pct) / 100.0f));
+ncR = (int)gdImageRed (src, c) * (pct / 100.0) 
++ gdImageRed (dst, dc) * ((100 - pct) / 
100.0);
+ncG = (int)gdImageGreen (src, c) * (pct / 100.0) 
++ (int)gdImageGreen (dst, dc) * ((100 - pct) 
/ 100.0);
+ncB = (int)gdImageBlue (src, c) * (pct / 100.0) 
++ gdImageBlue (dst, dc) * ((100 - pct) / 
100.0);
 
/* Find a reasonable color */
nc = gdImageColorResolve (dst, ncR, ncG, ncB);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/gd/libgd gd.c

2003-07-02 Thread Pierre-Alain Joye
pajoye  Wed Jul  2 07:33:35 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/gd/libgd   gd.c 
  Log:
  - tabs...
  
  
Index: php-src/ext/gd/libgd/gd.c
diff -u php-src/ext/gd/libgd/gd.c:1.24.2.15 php-src/ext/gd/libgd/gd.c:1.24.2.16
--- php-src/ext/gd/libgd/gd.c:1.24.2.15 Wed Jul  2 07:24:52 2003
+++ php-src/ext/gd/libgd/gd.c   Wed Jul  2 07:33:35 2003
@@ -2075,12 +2075,9 @@
} else {
dc = gdImageGetPixel(dst, tox, toy);
 
-ncR = (int)gdImageRed (src, c) * (pct / 100.0) 
-+ gdImageRed (dst, dc) * ((100 - pct) / 
100.0);
-ncG = (int)gdImageGreen (src, c) * (pct / 100.0) 
-+ (int)gdImageGreen (dst, dc) * ((100 - pct) 
/ 100.0);
-ncB = (int)gdImageBlue (src, c) * (pct / 100.0) 
-+ gdImageBlue (dst, dc) * ((100 - pct) / 
100.0);
+   ncR = (int)gdImageRed (src, c) * (pct / 100.0) + 
gdImageRed (dst, dc) * ((100 - pct) / 100.0);
+   ncG = (int)gdImageGreen (src, c) * (pct / 100.0) + 
(int)gdImageGreen (dst, dc) * ((100 - pct) / 100.0);
+   ncB = (int)gdImageBlue (src, c) * (pct / 100.0) + 
gdImageBlue (dst, dc) * ((100 - pct) / 100.0);
 
/* Find a reasonable color */
nc = gdImageColorResolve (dst, ncR, ncG, ncB);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php