Php/docs/function.imagesetthickness

提供:Dev Guides
< Php
移動先:案内検索

imagesetthickness

(PHP 4 >= 4.0.6, PHP 5, PHP 7)

imagesetthickness線描画用の線幅を設定する


説明

imagesetthickness ( resource $image , int $thickness ) : bool

imagesetthickness() は、長方形、多角形、弧などを描画する際の線幅を thickness ピクセルに設定します。


パラメータ

image
imagecreatetruecolor() のような画像作成関数が返す画像リソース。
thickness
ピクセル単位の線幅。


返り値

成功した場合に true を、失敗した場合に false を返します。


例1 imagesetthickness() の例

<?php// 200x100 の画像を作成します$im = imagecreatetruecolor(200, 100);$white = imagecolorallocate($im, 0xFF, 0xFF, 0xFF);$black = imagecolorallocate($im, 0x00, 0x00, 0x00);// 背景を白に設定しますimagefilledrectangle($im, 0, 0, 299, 99, $white);// 線幅を 5 に設定しますimagesetthickness($im, 5);// 矩形を描画しますimagerectangle($im, 14, 14, 185, 85, $black);// 画像をブラウザに出力しますheader('Content-Type: image/png');imagepng($im);imagedestroy($im);?>

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