示例#1
0
文件: gd.go 项目: tobi/mogrify-go
func (p *gdImage) gdCopy(dstX, dstY, srcX, srcY, dstW, dstH int) *gdImage {

	if p == nil || p.img == nil {
		panic(imageError)
	}

	dst := gdCreate(dstW, dstH)

	if dst == nil {
		return nil
	}

	C.gdImageCopy(dst.img, p.img, C.int(dstX), C.int(dstY), C.int(srcX), C.int(srcY), C.int(dstW), C.int(dstH))

	if isInvalid(dst) {
		dst.gdDestroy()
		return nil
	}

	return dst
}
示例#2
0
文件: gd.go 项目: trajber/go-gd
func (p *Image) Copy(dst *Image, dstX, dstY, srcX, srcY, w, h int) {
	C.gdImageCopy(dst.img, p.img, C.int(dstX), C.int(dstY), C.int(srcX), C.int(srcY), C.int(w), C.int(h))
}