ImageSetStyle

(PHP 4 = 4.0.6)

ImageSetStyle -- 線描画用のスタイルを設定する

説明

int imagesetstyle ( resource im, array style)

ImageSetStyle() は、特別な IMG_COLOR_STYLED または色を有するイメージの線 IMG_COLOR_STYLEDBRUSHED を描画する際に ( ImageLine() ImagePolygon() のような) 全ての線描画関数で使用されるスタイルを設定します。

パラメータ style はピクセルの配列です。以下 の例は、キャンバスの左上から右下隅に破線を描画するスクリプトです。

例 1ImageSetStyle

 ?php
Header ("Content-type: image/png");
$im  = imagecreate (100, 100);
$w   = ImageColorAllocate ($im, 255, 255, 255);
$red = ImageColorAllocate ($im, 255, 0, 0);
     
/* Draw a dashed line, 5 red pixels, 5 white pixels */
$style=array($red,$red,$red,$red,$red,$w,$w,$w,$w,$w);
ImageSetStyle($im, $style);
ImageLine($im, 0, 0, 100, 100, IMG_COLOR_STYLED);

/* Draw a line of happy faces using ImageSetBrush() with
ImageSetStyle */
$style=array($w,$w,$w,$w,$w,$w,$w,$w,$w,$w,$w,$w,$red);
ImageSetStyle($im, $style);

$brush=ImageCreateFromPng("http://www.libpng.org/pub/png/images/smile.happy.png");
ImageColorTransparent($brush, $w);
ImageSetBrush($im, $brush);
ImageLine($im, 100, 0, 0, 100, IMG_COLOR_STYLEDBRUSHED);

ImagePng($im);
ImageDestroy ($im);
? 


ImageSetBrush() , ImageLine() も参照下さい。

注意 この関数は、PHP 4.0.6で追加されました。