<?php
function imagefillroundedrect($im,$x,$y,$cx,$cy,$rad,$col)
{
// Draw the middle cross shape of the rectangle
imagefilledrectangle($im,$x,$y+$rad,$cx,$cy-$rad,$col);
imagefilledrectangle($im,$x+$rad,$y,$cx-$rad,$cy,$col);
$dia = $rad*2;
// Now fill in the rounded corners
imagefilledellipse($im, $x+$rad, $y+$rad, $rad*2, $dia, $col);
imagefilledellipse($im, $x+$rad, $cy-$rad, $rad*2, $dia, $col);
imagefilledellipse($im, $cx-$rad, $cy-$rad, $rad*2, $dia, $col);
imagefilledellipse($im, $cx-$rad, $y+$rad, $rad*2, $dia, $col);
}
$myImage = imagecreate(200,100);
$myGrey = imagecolorallocate($myImage,204,204,204);
$myBlack = imagecolorallocate($myImage,0,0,0);
imagefillroundedrect($myImage, 20, 10, 180, 90, 20, $myBlack);
header("Content-type: image/png");
imagepng($myImage);
imagedestroy($myImage);
?>Скопировать в буфер
Результат выполнения:
© Copyright 2008-2012 by KDG