Example #1
0
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
}
Example #2
0
File: gd.go Project: 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))
}