コード例 #1
0
ファイル: canvas.go プロジェクト: Terry-Mao/canvas
// 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")
}
コード例 #2
0
ファイル: pixel_wand.go プロジェクト: qwo/abelana-gcp
// 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
}
コード例 #3
0
ファイル: pixel_wand.go プロジェクト: palaiyacw/imagick
// 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
}
コード例 #4
0
ファイル: canvas.go プロジェクト: gronpipmaster/canvas
// 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
}
コード例 #5
0
ファイル: mage.go プロジェクト: dqminh/mage
// 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
}
コード例 #6
0
ファイル: pixel.go プロジェクト: gronpipmaster/canvas
func (self *Pixel) Destroy() {
	C.DestroyPixelWand(self.wand)
}
コード例 #7
0
ファイル: pixel_wand.go プロジェクト: fenglvming/paint
// Deallocates resources associated with a PixelWand.
func (p *PixelWand) Destroy() {
	C.DestroyPixelWand(p.wand)
}