コード例 #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
ファイル: magick_wand.go プロジェクト: rli-diraryi/paint
/* 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
ファイル: pixel_iterator.go プロジェクト: phacops/canvas
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))
}