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) FilledRectangle(x1, y1, x2, y2 int, color Color) { C.gdImageFilledRectangle(p.img, C.int(x1), C.int(y1), C.int(x2), C.int(y2), C.int(color)) }