image_package4.go 405 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(0, 0, 4, 3).Intersect(image.Rect(2, 2, 5, 5))
  11. // Size returns a rectangle's width and height, as a Point.
  12. fmt.Printf("%#v\n", r.Size()) // prints image.Point{X:2, Y:1}
  13. }