// Composite modifies the image, drawing the draw Image argument at offset // (x, y) using the c Composite operation. func (im *Image) Composite(c Composite, draw *Image, x int, y int) error { op, err := im.compositeOperator(c) if err != nil { return err } var ex C.ExceptionInfo C.GetExceptionInfo(&ex) defer C.DestroyExceptionInfo(&ex) var data C.CompositeData data.composite = C.int(op) data.draw = draw.image data.x = C.int(x) data.y = C.int(y) res, err := im.applyDataFunc("compositing", C.ImageDataFunc(C.compositeImage), &data) // res.image will be != than im.image when im is a non // coalesced animation if res.image != im.image { unrefImages(im.image) initializeRefCounts(res.image) refImages(res.image) im.image = res.image dontFree(res) } return err }
// Composite modifies the image, drawing the draw Image argument at offset // (x, y) using the c Composite operation. func (im *Image) Composite(c Composite, draw *Image, x int, y int) error { op, err := im.compositeOperator(c) if err != nil { return err } var ex C.ExceptionInfo C.GetExceptionInfo(&ex) defer C.DestroyExceptionInfo(&ex) var data C.CompositeData data.composite = C.int(op) data.draw = draw.image data.x = C.int(x) data.y = C.int(y) _, err = im.applyDataFunc("compositing", C.ImageDataFunc(C.compositeImage), &data) return err }