imageellipse()
imageellipse()函數接受六個參數,分別是:
函數執行成功時返回true ,如果失敗則返回false 。
<?php
// 創建一個空白的圖像
$image = imagecreatetruecolor(700, 350);
// 選擇背景色
$bg = imagecolorallocate($image, 0, 0, 0);
// 填充背景色
imagefill($image, 0, 0, $bg);
// 為橢圓選擇顏色
$col_ellipse = imagecolorallocate($image, 255, 255, 255);
// 繪製橢圓
imageellipse($image, 325, 175, 500, 175, $col_ellipse);
// 輸出圖像
header("Content-type: image/png");
imagepng($image);
?>
<?php
// 創建一個空白圖像
$image = imagecreatetruecolor(700, 600);
// 設置背景顏色
$bg = imagecolorallocate($image, 122, 122, 122);
// 填充背景顏色
imagefill($image, 0, 0, $bg);
// 設置橢圓的顏色
$col_ellipse = imagecolorallocate($image, 0, 255, 255);
// 繪製橢圓
imageellipse($image, 250, 300, 300, 550, $col_ellipse);
// 輸出圖像
header("Content-type: image/gif");
imagepng($image);
?>
通過以上兩個示例,我們演示瞭如何在PHP中使用imageellipse()函數繪製橢圓。此函數適用於各種圖像繪製任務,無論是在圖形處理應用中,還是在Web開發中處理圖像時都能派上用場。