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);
image functions?
Moderator: General Moderators
trythe first colour allocated is the background colour
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);