package main import ( "fmt" "image" ) func main() { p1 := image.Point{X: 10, Y: 20} p2 := image.Point{X: 5, Y: 10} p3 := p1.Add(p2) fmt.Println(p3) // Output: {15 30} }
package main import ( "fmt" "image" ) func main() { size := image.Point{X: 800, Y: 600} img := image.NewRGBA(image.Rectangle{image.Point{0, 0}, size}) fmt.Println(img.Bounds()) // Output: (0,0)-(800,600) }In this example, we create a Point size with X and Y coordinates. We then use this point to define the size of a new RGBA image img, by passing a Rectangle that goes from Point{0, 0} to size. We print out the bounds of the image to verify that it has been created with the correct size. Package Library: "image"