github.com/bgentry/go@v0.0.0-20150121062915-6cf5a733d54d/doc/progs/image_package2.go (about) 1 // cmpout 2 3 // Copyright 2012 The Go Authors. All rights reserved. 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file. 6 7 package main 8 9 import ( 10 "fmt" 11 "image" 12 ) 13 14 func main() { 15 r := image.Rect(2, 1, 5, 5) 16 // Dx and Dy return a rectangle's width and height. 17 fmt.Println(r.Dx(), r.Dy(), image.Pt(0, 0).In(r)) // prints 3 4 false 18 }