PHP 中的 imagefilledellipse() 函式


imagefilledellipse() 函式用於繪製一個填充的橢圓。

語法

imagefilledellipse( $img, $cx, $cy, $width, $height, $color )

引數

  • img 使用 imagecreatetruecolor() 建立一個空白影像

  • cx 圓心的 x 座標。

  • cy 圓心的 y 座標。

  • width 橢圓寬度。

  • height 橢圓高度。

  • color 填充顏色。

返回

imagefilledellipse() 函式在成功時返回 TRUE,失敗時返回 FALSE。

示例

以下是一個示例

<?php
   $img = imagecreatetruecolor(450, 290);
   $bgColor = imagecolorallocate($img, 140, 180, 140);
   imagefill($img, 0, 0, $bgColor);
   $ellipse = imagecolorallocate($img, 120, 50, 70);
   imagefilledellipse($img, 225, 150, 400, 250, $ellipse);
   header("Content-type: image/png");
   imagepng($img);
?>

以下是輸出

更新日期:2019 年 12 月 31 日

118 次瀏覽

啟動您的 職業生涯

完成課程以透過認證

開始學習
Advertisement 廣告
© . All rights reserved.