Ejemplo n.º 1
0
// 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")
}
Ejemplo n.º 2
0
// Frees all resources associated with the drawing wand. Once the drawing wand
// has been freed, it should not be used and further unless it re-allocated.
func (dw *DrawingWand) Destroy() {
	if dw.dw == nil {
		return
	}
	dw.dw = C.DestroyDrawingWand(dw.dw)
	C.free(unsafe.Pointer(dw.dw))
	dw.dw = nil

}
Ejemplo n.º 3
0
// Frees all resources associated with the drawing wand. Once the drawing wand
// has been freed, it should not be used and further unless it re-allocated.
func (dw *DrawingWand) Destroy() {
	if dw.dw == nil {
		return
	}
	dw.dw = C.DestroyDrawingWand(dw.dw)
	relinquishMemory(unsafe.Pointer(dw.dw))
	dw.dw = nil

}
Ejemplo n.º 4
0
// 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
}