PHP速学教程(入门到精通)
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
imagefilledpolygon() 是一个内置 php 函数,用于绘制填充多边形。
bool imagefilledpolygon($image, $points, $num_points, $color)
imagefilledpolygon()采用四个不同的参数 - $image、$points、$ num_points 和 $颜色。
$图像 - 使用 imagecreatetruecolor() 函数创建给定尺寸的空白图像。
$points - 保存多边形的连续顶点。
$num_points - 包含多边形中的顶点总数。点/顶点的总数必须至少为三个才能创建多边形。
$color - 包含使用 imagecolorallocate() 函数填充颜色标识符。
成功时返回 True,失败时返回 False。
<?php // set up array of points for a polygon $values = array( 40, 50, // Point 1 (x, y) 20, 240, // Point 2 (x, y) 60, 60, // Point 3 (x, y) 240, 20, // Point 4 (x, y) 50, 40, // Point 5 (x, y) 10, 10 // Point 6 (x, y) ); // create the image using imagecreatetruecolor function $img = imagecreatetruecolor(700, 350); // allocated the blue and gray colors $bg = imagecolorallocate($img, 122, 122, 122); $blue = imagecolorallocate($img, 0, 0, 255); // filled the background imagefilledrectangle($img, 0, 0, 350, 350, $bg); // draw a polygon imagefilledpolygon($img, $values, 6, $blue); // flush image header('Content-type: image/png'); imagepng($img); imagedestroy($img); ?>
<?php // Set the vertices of the polygon $values = array( 150, 50, // Point 1 (x, y) 55, 119, // Point 2 (x, y) 91, 231, // Point 3 (x, y) 209, 231, // Point 4 (x, y) 245, 119 // Point 5 (x, y) ); // It creates the size of the image or blank image. $img = imagecreatetruecolor(700, 350); // Set the gray background image color $bg = imagecolorallocate($img, 122, 122, 122); // Set the red image color $red = imagecolorallocate($img, 255, 0, 0); // fill the background imagefilledrectangle($img, 0, 0, 350, 350, $bg); // Draw the polygon image imagefilledpolygon($img, $values, 5, $red); // Output of the image. header('Content-type: image/png'); imagepng($img); imagedestroy($img); ?>
php免费学习视频:立即学习
踏上前端学习之旅,开启通往精通之路!从前端基础到项目实战,循序渐进,一步一个脚印,迈向巅峰!
已抢7204个
抢已抢94836个
抢已抢14826个
抢已抢52064个
抢已抢194759个
抢已抢87273个
抢