php imagerectangle()函数
|
imagerectangle()创建一个从指定坐标开始的矩形。 句法PHP imagerectangle()函数具有以下语法。 bool imagerectangle ( resource $image,int $x1,int $y1,int $x2,int $y2,int $color ) 参数PHP imagerectangle()函数具有以下参数。 image - 由图像创建函数(如imagecreatetruecolor())返回的图像资源。 x1 - 左上角x坐标。 y1 - 左上y坐标0,0是图像的左上角。 x2 - 右下角x坐标。 y2 - 右下y坐标。 color - 使用imagecolorallocate()创建的颜色标识符。 返回值成功时返回TRUE,失败时返回FALSE。 实例/* http://www.manongjc.com/article/1757.html 作者:脚本之家教程 */ // Create a 200 x 200 image $canvas = imagecreatetruecolor(200,200); // Allocate colors $pink = imagecolorallocate($canvas,255,105,180); $white = imagecolorallocate($canvas,255); $green = imagecolorallocate($canvas,132,135,28); // Draw three rectangles each with its own color imagerectangle($canvas,50,150,$pink); imagerectangle($canvas,45,60,120,100,$white); imagerectangle($canvas,75,160,$green); // Output and free from memory header('Content-Type: image/jpeg'); imagejpeg($canvas); imagedestroy($canvas); ?> (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
