image_package2.go 371 B

12345678910111213141516
  1. // Copyright 2012 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package main
  5. import (
  6. "fmt"
  7. "image"
  8. )
  9. func main() {
  10. r := image.Rect(2, 1, 5, 5)
  11. // Dx and Dy return a rectangle's width and height.
  12. fmt.Println(r.Dx(), r.Dy(), image.Pt(0, 0).In(r)) // prints 3 4 false
  13. }