imageellipse()函数是PHP中的一个内置函数,用于绘制椭圆。此函数在成功时返回TRUE,失败时返回FALSE。
null
语法:
bool imageellipse( $image, $cx, $cy, $width, $height, $color )
参数: 此函数接受六个参数,如下所述:
- $image: 它由一个图像创建函数返回,例如imagecreatetruecolor()。它用于创建图像的大小。
- $cx: 中心的x坐标。
- $cy: 中心的y坐标。
- $width: 椭圆的宽度。
- $height: 椭圆的高度。
- $color: 它设置椭圆的颜色。由imagecolorallocate()函数创建的颜色标识符。
返回值: 成功时返回TRUE,失败时返回FALSE。
下面的程序演示了PHP中的imageellipse()函数:
项目1:
<?php // It create the size of image or blank image. $image_size = imagecreatetruecolor(500, 300); // Set the background color of image. $background_color = imagecolorallocate( $image_size , 255, 255, 255); // Fill background with above selected color. imagefill( $image_size , 0, 0, $background_color ); // set color of ellipse. $ellipse_color = imagecolorallocate( $image_size , 0, 0, 0); // Function to draw the ellipse. imageellipse( $image_size , 250, 150, 400, 250, $ellipse_color ); // Output the image. header( "Content-type: image/png" ); imagepng( $image_size ); ?> |
输出:
项目2:
<?php // It create the size of image or blank image. $image = imagecreatetruecolor(300, 500); // Set the background color of image. $bg = imagecolorallocate( $image , 0, 102, 0); // Fill background with above selected color. imagefill( $image , 0, 0, $bg ); // set color of ellipse. $col_ellipse = imagecolorallocate( $image , 255, 255, 255); // Function to draw the ellipse. imageellipse( $image , 150, 250, 250, 400, $col_ellipse ); // Output the image. header( "Content-type: image/png" ); imagepng( $image ); ?> |
输出:
参考: http://php.net/manual/en/function.imageellipse.php
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END