github.com/roboticscm/goman@v0.0.0-20210203095141-87c07b4a0a55/doc/progs/image_package3.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).Add(image.Pt(-4, -2))
    16  	fmt.Println(r.Dx(), r.Dy(), image.Pt(0, 0).In(r)) // prints 3 4 true
    17  }