fill

.fill( color, alpha=1 )

Takes a colour, and fills the entire Image using this colour. See the article on Using Colors for an explanation of the colour values this method can take.

It can optionally take an 'alpha' value, for deciding the transparency to use when filling, and this defaults to 1.0.

Note that fill ignores transformations, and will always fill the whole Image.

img = new Image( 50, 50 )

// fill the image with a greeny-white colour
img.fill( :white )
img.fill( :green, 0.6 )

.fill( red, green, blue, alpha=1 )

This version allows you to specify the individual red, green and blue components to use, for the colour that fills this Image.

img = new Image( 50, 50 )

img.fill( 255, 0, 0 ) // fill with red
img.fill( 0, 255, 0, 0.6 ) // fill with some green