(PHP 4 >= 4.0.6)

ImageSetStyle -- Set the style for line drawing


int imagesetstyle (resource im, 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.

The style parameter is an array of pixels. Following example script draws a dashed line from upper left to lower right corner of the canvas:

Example 1. ImageSetStyle

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 */
ImageSetStyle($im, $style);
ImageLine($im, 0, 0, 100, 100, IMG_COLOR_STYLED);

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

ImageColorTransparent($brush, $w);
ImageSetBrush($im, $brush);
ImageLine($im, 100, 0, 0, 100, IMG_COLOR_STYLEDBRUSHED);

ImageDestroy ($im);

See also ImageSetBrush(), ImageLine().

Note: This function was added in PHP 4.0.6