image_package6.go 448 B

1234567891011121314151617
  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. m0 := image.NewRGBA(image.Rect(0, 0, 8, 5))
  11. m1 := m0.SubImage(image.Rect(1, 2, 5, 5)).(*image.RGBA)
  12. fmt.Println(m0.Bounds().Dx(), m1.Bounds().Dx()) // prints 8, 4
  13. fmt.Println(m0.Stride == m1.Stride) // prints true
  14. }