// create a new image img := image.NewRGBA(image.Rect(0, 0, 100, 100)) // set the color to green green := color.RGBA{0, 255, 0, 255} // draw the rectangle draw.Draw(img, img.Bounds(), &image.Uniform{green}, image.Point{}, draw.Src)
// create a new image img := image.NewRGBA(image.Rect(0, 0, 100, 100)) // set the color to red red := color.RGBA{255, 0, 0, 255} // draw the line draw.Line(img, 10, 10, 90, 90, red)
// create a new image img := image.NewRGBA(image.Rect(0, 0, 100, 100)) // set the color to blue blue := color.RGBA{0, 0, 255, 255} // draw the ellipse draw.Draw(img, img.Bounds(), &image.Uniform{blue}, image.Point{}, draw.Src) draw.Ellipse(img, 50, 50, 40, 30, blue)In these examples, the package library used is clearly image/draw. The examples show how to create a new image, set a color, and then use the draw functions to draw shapes on the image.