// Destroys canvas. func (self Canvas) Destroy() error { if self.wand != nil { C.DestroyMagickWand(self.wand) self.wand = nil } if self.bg != nil { C.DestroyPixelWand(self.bg) self.bg = nil } if self.fg != nil { C.DestroyPixelWand(self.fg) self.fg = nil } if self.stroke != nil { C.DestroyPixelWand(self.stroke) self.stroke = nil } if self.fill != nil { C.DestroyPixelWand(self.fill) self.fill = nil } if self.drawing != nil { C.DestroyDrawingWand(self.drawing) self.drawing = nil } return fmt.Errorf("Nothing to destroy") }
// Deallocates resources associated with a pixel wand func (pw *PixelWand) Destroy() { if pw.pw == nil { return } pw.pw = C.DestroyPixelWand(pw.pw) C.free(unsafe.Pointer(pw.pw)) pw.pw = nil }
// Deallocates resources associated with a pixel wand func (pw *PixelWand) Destroy() { if pw.pw == nil { return } pw.pw = C.DestroyPixelWand(pw.pw) relinquishMemory(unsafe.Pointer(pw.pw)) pw.pw = nil }
// Destroys canvas. func (self *Canvas) Destroy() error { if self.bg != nil { C.DestroyPixelWand(self.bg) self.bg = nil } if self.fg != nil { C.DestroyPixelWand(self.fg) self.fg = nil } if self.stroke != nil { C.DestroyPixelWand(self.stroke) self.stroke = nil } if self.fill != nil { C.DestroyPixelWand(self.fill) self.fill = nil } if self.drawing != nil { C.DestroyDrawingWand(self.drawing) self.drawing = nil } if self.wand == nil { return errors.New("Nothing to destroy") } else { C.DestroyMagickWand(self.wand) self.wand = nil } if self.text != nil && self.text.UnderColor != nil { C.DestroyPixelWand(self.text.UnderColor) self.text.UnderColor = nil } return nil }
// Private: Create a blank magick wand with size width and height // // Params: // - format: format of the new image // - width: width of the new image // - height: height of the new image // // Examples // blankWand("jpg", 100, 100) // // Return *C.MagickWand func blankWand(format string, width, height int) *C.MagickWand { wand := C.NewMagickWand() cformat := C.CString(format) noneBackground := C.CString("none") defer C.free(unsafe.Pointer(cformat)) defer C.free(unsafe.Pointer(noneBackground)) C.MagickSetFormat(wand, C.CString(format)) pixel := C.NewPixelWand() defer C.DestroyPixelWand(pixel) C.PixelSetColor(pixel, noneBackground) C.MagickSetSize(wand, C.size_t(width), C.size_t(height)) C.MagickNewImage(wand, C.size_t(width), C.size_t(height), pixel) return wand }
func (self *Pixel) Destroy() { C.DestroyPixelWand(self.wand) }
// Deallocates resources associated with a PixelWand. func (p *PixelWand) Destroy() { C.DestroyPixelWand(p.wand) }