Golang image.Point type and Pt function usage example

package image

A Point is an X, Y coordinate pair. The axes increase right and down.

Golang image.Point type and Pt function usage example

 package main

 import (
 "fmt"
 "image"
 )

 func main() {

 rect := image.Rectangle{image.Point{0, 0}, image.Point{200, 200}}

 data := image.NewRGBA(rect)

 bounds := data.Bounds()

 fmt.Println(bounds)

 var aPoint image.Point

 aPoint = image.Pt(10,10)

 fmt.Println("X : ", aPoint.X)

 fmt.Println("Y : ", aPoint.Y)

 }

Output :

(0,0)-(200,200)

X : 10

Y : 10

References :

http://golang.org/pkg/image/#Point

http://golang.org/pkg/image/#Pt

Advertisement