contents   index   previous   next



GD setBrush()

syntax:

gd.setBrush(brush)

where:

brush - A GD image to use as the current brush in this image

 

return:

void.

 

description:

This method sets the current brush for this image to be the image specified by brush. This image is then used for drawing when the "brushed" string is used as a color parameter to a drawing function. This method attempts to preserve the colors of the brush in the current image, including the transparent color. Transparent pixels are not draw when using the brush, allowing for brushes of any shape. The original brush must remain a valid image. Once destroy() has been called on the supplied brush, the style "brushed" can no longer be used until another brush is set. Note that because this can allocate colors in the image, do not set the brush if you won't be using it, because the color table could fill up quickly.

 

see:

#link <gd>, GD setTile()

 

example:

var brush = GD.fromGif("brush.gif");

var gd = new GD(64,64);

gd.setBrush( brush );

gd.line( [16,3], [52,45], "brushed" );

brush.destroy();

 


GD setPixel()