func (p *gdImage) gdCopyResized(dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH int) *gdImage { if p == nil || p.img == nil { panic(imageError) } dst := gdCreate(dstW, dstH) if dst == nil { return nil } transparency := C.gdImageColorAllocateAlpha(dst.img, 255, 255, 255, 127) C.gdImageFilledRectangle(dst.img, C.int(dstX), C.int(dstY), C.int(dstW), C.int(dstH), transparency) C.gdImageColorTransparent(dst.img, transparency) C.gdImageCopyResized(dst.img, p.img, C.int(dstX), C.int(dstY), C.int(srcX), C.int(srcY), C.int(dstW), C.int(dstH), C.int(srcW), C.int(srcH)) if isInvalid(dst) { dst.gdDestroy() return nil } return dst }
func (p *Image) CopyResized(dst *Image, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH int) { C.gdImageCopyResized(dst.img, p.img, C.int(dstX), C.int(dstY), C.int(srcX), C.int(srcY), C.int(dstW), C.int(dstH), C.int(srcW), C.int(srcH)) }