Creates a new image with the same dimensions as a source image, setting each pixel to the specified colour.
In addition to the colour, the function accepts a Painter which can be used to apply a gradient.
Using this image as our input:
// a new image with all pixels blue, and the dimensions // taken from the source image image.fill(Color.BLUE)
// a new image with the pixels coloured from the given vertical gradient. image.fill(LinearGradient.vertical(Color.BLACK, Color.WHITE))
// a new image with the pixels coloured from the given horizontal gradient image.fill(LinearGradient.horizontal(Color.BLACK, Color.WHITE))