首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

imageopenpolygon

(PHP 7 >= 7.2.0)

imageopenpolygon - 绘制一个开放的多边形

描述

代码语言:javascript
复制
bool imageopenpolygon ( resource $image , array $points , int $num_points , int $color )

imageopenpolygon()在给定的地方绘制一个开放的多边形image。与imagepolygon()相反,最后一个点和第一个点之间没有画线。

参数

代码语言:txt
复制
`image`   

一个图像资源,由图像创建函数之一返回,如imagecreatetruecolor()。

points

包含多边形顶点的数组,例如:

points0

= x0

points1

= y0

points2

= x1

points3

= y1

num_points

点(顶点)的总数。

color

使用imagecolorallocate()创建的颜色标识符。

返回值

返回TRUE成功或失败时返回FALSE

例子

Example #1 imageopenpolygon() example

代码语言:javascript
复制
<?php
//?Create?a?blank?image
$image?=?imagecreatetruecolor(400,?300);

//?Allocate?a?color?for?the?polygon
$col_poly?=?imagecolorallocate($image,?255,?255,?255);

//?Draw?the?polygon
imageopenpolygon($image,?array(
????????0,???0,
????????100,?200,
????????300,?200
????),
????3,
????$col_poly);

//?Output?the?picture?to?the?browser
header('Content-type:?image/png');

imagepng($image);
imagedestroy($image);
?>

上面的例子会输出类似于:

← imageloadfont

imagepalettecopy →

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com