image_package3.go 339 B

123456789101112131415
  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).Add(image.Pt(-4, -2))
  11. fmt.Println(r.Dx(), r.Dy(), image.Pt(0, 0).In(r)) // prints 3 4 true
  12. }