导航首页 »  技术教程 »  PHP:imagefilledellipse()的用法_GD库图像处理函数
PHP:imagefilledellipse()的用法_GD库图像处理函数 1140 2023-12-15   

imagefilledellipse

(PHP 4 >= 4.0.6, PHP 5)

imagefilledellipse — 画一椭圆并填充

说明

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

画一椭圆并填充到指定的 image

参数

image

由图象创建函数(例如imagecreatetruecolor())返回的图象资源。

cx

中央的 x 坐标。

cy

中央的 y 坐标。

width

椭圆的宽度。

height

椭圆的高度。

color

要填充的颜色。颜色标识由函数 imagecolorallocate() 创建。

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE

范例

Example #1 imagefilledellipse() 例子

<?php

// create a blank image
$image = imagecreatetruecolor(400, 300);

// fill the background color
$bg = imagecolorallocate($image, 0, 0, 0);

// choose a color for the ellipse
$col_ellipse = imagecolorallocate($image, 255, 255, 255);

// draw the white ellipse
imagefilledellipse($image, 200, 150, 300, 200, $col_ellipse);

// output the picture
header("Content-type: image/png");
imagepng($image);

?>

以上例程的输出类似于:

注释

Note: 此函数需要 GD 2.0.1 或更高版本(推荐 2.0.28 及更高版本)。

参见

imageellipse() - 画一个椭圆 imagefilledarc() - 画一椭圆弧且填充



文章评论 (0条)
发表评论
暂无评论,快来抢沙发吧~