示例#1
0
// Associates one or options with the wand (.e.g
// SetOption(wand, "jpeg:perserve", "yes")).
func (mw *MagickWand) SetOption(key, value string) error {
	cskey := C.CString(key)
	defer C.free(unsafe.Pointer(cskey))
	csvalue := C.CString(value)
	defer C.free(unsafe.Pointer(csvalue))
	C.MagickSetOption(mw.mw, cskey, csvalue)
	return mw.GetLastError()
}
示例#2
0
文件: canvas.go 项目: phacops/canvas
func (self *Canvas) SetOption(key, value string) error {
	ckey := C.CString(key)
	cvalue := C.CString(value)

	defer C.free(unsafe.Pointer(ckey))
	defer C.free(unsafe.Pointer(cvalue))

	if C.MagickSetOption(self.wand, ckey, cvalue) == C.MagickFalse {
		return fmt.Errorf(`Could not set option "%s" to "%s": %s`, ckey, cvalue, self.Error())
	}

	return nil
}