示例#1
0
文件: canvas.go 项目: phacops/canvas
// Returns the latest error reported by the MagickWand API.
func (self *Canvas) Error() error {
	var t C.ExceptionType
	ptr := C.MagickGetException(self.wand, &t)
	message := C.GoString(ptr)
	C.MagickClearException(self.wand)
	C.MagickRelinquishMemory(unsafe.Pointer(ptr))
	return errors.New(message)
}
示例#2
0
/* Returns the severity, reason, and description of any error that occurs when
   using other methods in this API.
*/
func (w *MagickWand) Exception() (string, int) {
	var severity C.ExceptionType
	errPtr := C.MagickGetException(w.wand, &severity)
	C.MagickClearException(w.wand)
	err := C.GoString(errPtr)
	C.MagickRelinquishMemory(unsafe.Pointer(errPtr))
	return err, int(severity)
}
示例#3
0
func (self *PixelIterator) Error() error {
	var exception C.ExceptionType

	ptr := C.MagickGetException(self.iterator, &exception)
	message := C.GoString(ptr)

	C.MagickClearException(self.iterator)
	C.MagickRelinquishMemory(unsafe.Pointer(ptr))

	return errors.New(message)
}
示例#4
0
// Clears any exceptions associated with the wand
func (mw *MagickWand) clearException() bool {
	return 1 == C.int(C.MagickClearException(mw.mw))
}
示例#5
0
文件: canvas.go 项目: jmrobles/canvas
// Returns the latest error reported by the MagickWand API.
func (self Canvas) Error() error {
	var t C.ExceptionType
	message := C.MagickGetException(self.wand, &t)
	C.MagickClearException(self.wand)
	return fmt.Errorf(C.GoString(message))
}