update : 2015.11.03
php.shukuma.com

검색:
 
 
Set the style for line drawing

imagesetstyle

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

imagesetstyleSet the style for line drawing

설명

bool imagesetstyle ( resource $image , array $style )

imagesetstyle() sets the style to be used by all line drawing functions (such as imageline() and imagepolygon()) when drawing with the special color IMG_COLOR_STYLED or lines of images with color IMG_COLOR_STYLEDBRUSHED.

인수

image

imagecreatetruecolor() 등의 이미지 생성 함수에서 반환한 이미지 자원.

style

An array of pixel colors. You can use the IMG_COLOR_TRANSPARENT constant to add a transparent pixel.

반환값

성공 시 TRUE를, 실패 시 FALSE를 반환합니다.

예제

Following example script draws a dashed line from upper left to lower right corner of the canvas:

Example #1 imagesetstyle() example

<?php
header
("Content-type: image/jpeg");
$im  imagecreatetruecolor(100100);
$w   imagecolorallocate($im255255255);
$red imagecolorallocate($im25500);

/* 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($im00100100IMG_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");
$w2 imagecolorallocate($brush255255255);
imagecolortransparent($brush$w2);
imagesetbrush($im$brush);
imageline($im10000100IMG_COLOR_STYLEDBRUSHED);

imagejpeg($im);
imagedestroy($im);
?>

위 예제의 출력 예시:

Output of example : imagesetstyle()

참고