畫橢圓弧

imagearc

(PHP 4, PHP 5, PHP 7, PHP 8)

imagearc — 畫橢圓弧

說明

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

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

示例 #1 用 imagearc() 畫一個圓

<?php
// 建立一個 200X200 的影象
$img = imagecreatetruecolor(200, 200);
// 分配顏色
$white = imagecolorallocate($img, 255, 255, 255);
$black = imagecolorallocate($img, 0, 0, 0);
// 畫一個黑色的圓
imagearc($img, 100, 100, 150, 150, 0, 360, $black);
// 將影象輸出到瀏覽器
header("Content-type: image/png");
imagepng($img);
// 釋放記憶體
imagedestroy($img);
?>

參見 imageellipse(),imagefilledellipse() 和 imagefilledarc()。

Leave a Reply

Your email address will not be published. Required fields are marked *