github.com/zach-klippenstein/go@v0.0.0-20150108044943-fcfbeb3adf58/doc/progs/image_package4.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(0, 0, 4, 3).Intersect(image.Rect(2, 2, 5, 5))
    16  	// Size returns a rectangle's width and height, as a Point.
    17  	fmt.Printf("%#v\n", r.Size()) // prints image.Point{X:2, Y:1}
    18  }