-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Closed
Labels
Description
What version of Go are you using (go version)?
go version go1.12.1 linux/amd64
Does this issue reproduce with the latest release?
Not
What operating system and processor architecture are you using (go env)?
GOARCH="amd64" GOBIN="" GOCACHE="/home/work/.cache/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/work/go" GOPROXY="" GORACE="" GOROOT="/usr/local/go" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GCCGO="gccgo" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/home/work/fencoder/huifang-fencoder/go.mod" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build595600236=/tmp/go-build -gno-record-gcc-switches"
What did you do?
I want to capture part of the RGBA image with rectangle by using image.RGBA.SubImage funcation.
func subimage(src *image.RGBA, rect image.Rectangle) *image.RGBA {
// src.Rect = image.Rectangle{
// Min: image.Point{0, 0},
// Max: image.Point{1000, 1000},
// }
dstrect := image.Rect(100, 100, 200, 200)
dstimage := src.SubImage(dstrect)
fmt.Println("dstimage rectangle: ", dstimage.Bounds())
return dstimage.(*image.RGBA)
}What did you expect to see?
dstimage rectangle: (0,0)-(100,100)
that equal image.Rect(0, 0, rect.Dx(), rect.Dy())
What did you see instead?
for above code
dstimage rectangle: (100,100)-(200,200)