Beispiel #1
0
/*
Dissovle() sets transparency of this image to the specified value dissolve

dissolve: 0~100,0 means totally transparent while 100 means opa
*/
func (this *Image) Dissolve(dissolve int) error {
	if this.magickWand == nil {
		return errors.New("error dissolve image:magickwand is nil")
	}

	status := C.dissolveImage(this.magickWand, C.uint(dissolve))
	if status == 0 {
		var etype int
		descr := C.MagickGetException(this.magickWand, (*C.ExceptionType)(unsafe.Pointer(&etype)))
		defer C.MagickRelinquishMemory(unsafe.Pointer(descr))
		return errors.New(fmt.Sprintf("error scale image: %s (ExceptionType = %d)", C.GoString(descr), etype))
	}

	return nil
}
Beispiel #2
0
/*
Dissovle() sets transparency of this image to the specified value dissolve

dissolve: 0~100,0 means totally transparent while 100 means opa
*/
func (this *Image) Dissolve(dissolve int) error {
	var err error = nil
	tran := this.Cat.NewTransaction("GraphicsMagickCmd", "Dissolve")
	defer func() {
		tran.SetStatus(err)
		tran.Complete()
	}()
	if this.magickWand == nil {
		err = errors.New("error dissolve image:magickwand is nil")
		return err
	}

	status := C.dissolveImage(this.magickWand, C.uint(dissolve))
	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 scale image: %s (ExceptionType = %d)", C.GoString(descr), etype))
		return err
	}

	return nil
}