Page 1 of 1

image functions?

Posted: Thu Mar 06, 2003 12:19 am
by Jugular
I'm trying to draw two rectangles in an image to achieve a square with a one pixel rounded edges. What I get is one rectangle with no roundness. Any ideas? Here's the main section of code I'm trying:

$pic=imageCreate($boxWidth,$boxHeight);
imageFilledRectangle($pic, $boxLeft+1, $boxTop, $boxRight-1, $boxBottom, imageColorAllocate($pic,$boxGray,$boxGray,$boxGray));
imageFilledRectangle($pic, $boxLeft, $boxTop+1, $boxRight, $boxBottom-1, imageColorAllocate($pic,$boxGray,$boxGray,$boxGray));
Header("Content-type: image/png");
imagePNG($pic);
imageDestroy($pic);

Posted: Thu Mar 06, 2003 2:14 am
by volka
try

Code: Select all

$pic = imagecreate($boxWidth,$boxHeight);
$colorBG = imageColorAllocate($pic, 255, 255, 255);
$colorFG = imageColorAllocate($pic, $boxGray, $boxGray, $boxGray);
imageFilledRectangle($pic, $boxLeft+1, $boxTop, $boxRight-1, $boxBottom, $colorFG);
imageFilledRectangle($pic, $boxLeft, $boxTop+1, $boxRight, $boxBottom-1, $colorFG); 

Header("Content-type: image/png");
imagePNG($pic);
imageDestroy($pic);
the first colour allocated is the background colour