Example #1
0
// Sets canvas' background color.
func (cv Canvas) SetBackgroundColor(color string) bool {
	C.PixelSetColor(cv.bg, C.CString(color))
	status := C.MagickSetImageBackgroundColor(cv.wand, cv.bg)
	if status == C.MagickFalse {
		return false
	}
	return true
}
Example #2
0
// Sets the image background color.
func (w *MagickWand) SetImageBackgroundColor(bg *PixelWand) error {
	if C.MagickSetImageBackgroundColor(w.wand, bg.wand) == C.MagickFalse {
		eStr, eCode := w.Exception()
		return fmt.Errorf("SetImageBackgroundColor() failed : [%d] %s", eStr, eCode)
	}

	return nil
}
Example #3
0
// Sets canvas' background color.
func (self Canvas) SetBackgroundColor(color string) error {
	C.PixelSetColor(self.bg, C.CString(color))
	success := C.MagickSetImageBackgroundColor(self.wand, self.bg)

	if success == C.MagickFalse {
		return fmt.Errorf("Could not set background color: %s", self.Error())
	}

	return nil
}
Example #4
0
// Sets canvas' background color.
func (self *Canvas) SetBackgroundColor(color string) error {
	var status C.MagickBooleanType

	ccolor := C.CString(color)
	status = C.PixelSetColor(self.bg, ccolor)
	C.free(unsafe.Pointer(ccolor))

	if status == C.MagickFalse {
		return fmt.Errorf("Could not set pixel color: %s", self.Error())
	}

	status = C.MagickSetImageBackgroundColor(self.wand, self.bg)

	if status == C.MagickFalse {
		return fmt.Errorf("Could not set background color: %s", self.Error())
	}

	return nil
}