imagearc

(PHP 3, PHP 4, PHP 5)

imagearc -- 畫橢圓弧

說明

bool imagearc ( resource image, int cx, int cy, int w, int h, int s, int e, int color )

imagearc()cxcy(圖像左上角為 0, 0)為中心在 image 所代表的圖像中畫一個橢圓弧。wh 分別指定了橢圓的寬度和高度,起始和結束點以 se 參數以角度指定。0°位於三點鐘位置,以順時針方向繪畫。

例子 1. 用 imagearc() 畫一個圓

<?php
// 建立一個 200X200 的圖像
$img imagecreatetruecolor(200200);
// 配置彩色
$white imagecolorallocate($img255255255);
$black imagecolorallocate($img000);
// 畫一個黑色的圓
imagearc($img1001001501500360$black);
// 將圖像輸出到瀏覽器
header("Content-type: image/png");
imagepng($img);
// 釋放記憶體
imagedestroy($img);
?>

參見 imageellipse()imagefilledellipse()imagefilledarc()