imagefilledarc
(PHP 4 >= 4.0.6, PHP 5, PHP 7)
imagefilledarc — 楕円弧を描画し、塗りつぶす
説明
imagefilledarc
( resource $image
, int $cx
, int $cy
, int $width
, int $height
, int $start
, int $end
, int $color
, int $style
) : bool
指定した image
の指定した座標を中心とする、
楕円弧を描画します。
パラメータ
image
imagecreatetruecolor() のような画像作成関数が返す画像リソース。
cx
中心の x 座標。
cy
中心の y 座標。
width
弧の幅。
height
弧の高さ。
start
弧の開始角度。
end
弧の終了角度。 0° は三時の方向で、そこから時計回りに数えます。
color
imagecolorallocate() で作成された色識別子。
style
次の選択肢のビット和。
IMG_ARC_PIE
IMG_ARC_CHORD
IMG_ARC_NOFILL
IMG_ARC_EDGED
IMG_ARC_PIE
およびIMG_ARC_CHORD
は相反します。IMG_ARC_CHORD
は、 開始角と終了角を直線で結ぶだけですが、IMG_ARC_PIE
は、角を丸めます。IMG_ARC_NOFILL
は、弧と弦が縁どられ塗りつぶされないことを指定します。IMG_ARC_EDGED
は、IMG_ARC_NOFILL
と共に指定することにより、 開始角と終端角は中心と結ばれます。これは、(塗りつぶすよりも) 「パイの切れ端」を縁どる良い方法です。
返り値
成功した場合に true
を、失敗した場合に false
を返します。
例
例1 3D 風のパイを作成する
<?php// 画像を作成します$image = imagecreatetruecolor(100, 100);// 色を割り当てます$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);$gray = imagecolorallocate($image, 0xC0, 0xC0, 0xC0);$darkgray = imagecolorallocate($image, 0x90, 0x90, 0x90);$navy = imagecolorallocate($image, 0x00, 0x00, 0x80);$darknavy = imagecolorallocate($image, 0x00, 0x00, 0x50);$red = imagecolorallocate($image, 0xFF, 0x00, 0x00);$darkred = imagecolorallocate($image, 0x90, 0x00, 0x00);// 3D 効果を作成しますfor ($i = 60; $i > 50; $i--) { imagefilledarc($image, 50, $i, 100, 50, 0, 45, $darknavy, IMG_ARC_PIE); imagefilledarc($image, 50, $i, 100, 50, 45, 75 , $darkgray, IMG_ARC_PIE); imagefilledarc($image, 50, $i, 100, 50, 75, 360 , $darkred, IMG_ARC_PIE);}imagefilledarc($image, 50, 50, 100, 50, 0, 45, $navy, IMG_ARC_PIE);imagefilledarc($image, 50, 50, 100, 50, 45, 75 , $gray, IMG_ARC_PIE);imagefilledarc($image, 50, 50, 100, 50, 75, 360 , $red, IMG_ARC_PIE);// 画像を出力しますheader('Content-type: image/png');imagepng($image);imagedestroy($image);?>
上の例の出力は、 たとえば以下のようになります。