/* CreateWand() creates a new wand for this Image by using Blob data */ func (this *Image) CreateWand() error { if this.magickWand != nil { this.DestoryWand() } status := C.createWand(&this.magickWand, (*C.uchar)(unsafe.Pointer(&this.Blob[0])), C.size_t(len(this.Blob))) if status == 0 { var etype int descr := C.MagickGetException(this.magickWand, (*C.ExceptionType)(unsafe.Pointer(&etype))) defer C.MagickRelinquishMemory(unsafe.Pointer(descr)) err := errors.New(fmt.Sprintf("error create magick wand: %s (ExceptionType = %d)", C.GoString(descr), etype)) this.DestoryWand() return err } return nil }
/* CreateWand() creates a new wand for this Image by using Blob data */ func (this *Image) CreateWand() error { var err error = nil tran := this.Cat.NewTransaction("GraphicsMagickCmd", "CreateWand") defer func() { tran.SetStatus(err) tran.Complete() }() if this.magickWand != nil { this.DestoryWand() } status := C.createWand(&this.magickWand, (*C.uchar)(unsafe.Pointer(&this.Blob[0])), C.size_t(len(this.Blob))) if status == 0 { var etype int descr := C.MagickGetException(this.magickWand, (*C.ExceptionType)(unsafe.Pointer(&etype))) defer C.MagickRelinquishMemory(unsafe.Pointer(descr)) err = errors.New(fmt.Sprintf("error create magick wand: %s (ExceptionType = %d)", C.GoString(descr), etype)) this.DestoryWand() return err } return nil }