imagearcとは? わかりやすく解説

imagearc

(PHP 4, PHP 5)
imagearc — 部分楕円を描画する

説明

bool imagearc ( resource image, int cx, int cy, int width, int height, int start, int end, int color )
imagearc() は、指定した座標を中心とする円弧を描画します。

パラメータ

image
imagecreatetruecolor() のような画像作成関数が返す画像リソース。
cx
中心の x 座標。
cy
中心の y 座標。
width
円弧の幅。
height
円弧の高さ。
start
始点の角度。
end
終点の角度。 0° は 3 時の位置で、そこから時計回りの方向に円弧が描かれます。
color
imagecolorallocate() で作成した色 ID。

返り値

成功した場合に TRUE を、失敗した場合に FALSE を返します。

例 909. imagearc() による円の描画
<?php

// 200*200 の画像を作成します
$img = imagecreatetruecolor(200, 200);

// 色を設定します
$white = imagecolorallocate($img, 255, 255, 255);
$red  = imagecolorallocate($img, 255,  0,  0);
$green = imagecolorallocate($img,  0, 255,  0);
$blue  = imagecolorallocate($img,  0,  0, 255);

// 頭を描きます
imagearc($img, 100, 100, 200, 200,  0, 360, $white);
// 口を描きます
imagearc($img, 100, 100, 150, 150, 25, 155, $red);
// 左右の目を描きます
imagearc($img,  60,  75,  50,  50,  0, 360, $green);
imagearc($img, 140,  75,  50,  50,  0, 360, $blue);

// 画像をブラウザに出力します
header("Content-type: image/png");
imagepng($img);

// メモリを解放します
imagedestroy($img);

?>
上の例の出力は、たとえば 以下のようになります。
imagearc

参考

imagefilledarc()
imageellipse()
imagefilledellipse()





固有名詞の分類

このページでは「PHP関数リファレンス」からimagearcを検索した結果を表示しています。
Weblioに収録されているすべての辞書からimagearcを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からimagearcを検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「imagearc」の関連用語

imagearcのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



imagearcのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
PHP Documentation GroupPHP Documentation Group
Copyright © 1997 - 2024 by the PHP Documentation Group.

©2024 GRAS Group, Inc.RSS