加入收藏 | 设为首页 | 会员中心 | 我要投稿 安卓应用网 (https://www.0791zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > PHP > 正文

php imageellipse()函数

发布时间:2020-05-25 02:24:43 所属栏目:PHP 来源:互联网
导读:php imageellipse()函数用于绘制以指定坐标为中心的椭圆。 本文章向大家介绍php imageellipse()函数的基本使用方法和实例,需要的朋友可以参考一下。

php imageellipse()函数绘制以指定坐标为中心的椭圆。

语法

PHP imageellipse()函数具有以下语法。

bool imageellipse(resource $image,int $cx,int $cy,int $width,int $height,int $color )

参数

PHP imageellipse()函数具有以下参数。

image - 由图像创建函数(如imagecreatetruecolor())返回的图像资源。

cx - 中心的x坐标。

中心的cy-y坐标。

width - 椭圆宽度。

height - 椭圆高度。

color - 椭圆的颜色。使用imagecolorallocate()创建的颜色标识符。

返回值

成功时返回TRUE,失败时返回FALSE。

画圆和椭圆

要在PHP中绘制圆和椭圆,请使用imageellipse()函数。

我们提供中心点,然后指定椭圆应该有多高和多宽。

imageellipse($myImage,90,60,160,50,$myBlack);

这个椭圆在像素上的中心是(90,60)。椭圆的宽度为160像素,高度为50像素。

要绘制圆形,只需描述具有相同宽度和高度的椭圆形:

imageellipse($myImage,70,$myBlack);

实例

/*

http://www.manongjc.com/article/1753.html

作者:脚本之家教程

*/

$image = imagecreatetruecolor(400,300);

// Select the background color.

$bg = imagecolorallocate($image,0);

// Fill the background with the color selected above.

imagefill($image,$bg);

// Choose a color for the ellipse.

$col_ellipse = imagecolorallocate($image,255,255);

// Draw the ellipse.

imageellipse($image,200,150,300,$col_ellipse);

// Output the image.

header("Content-type: image/png");

imagepng($image);

?>

(编辑:安卓应用网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读