Exemple #1
0
// Adjusts the canvas's brightness given a factor (-1.0 thru 1.0)
func (self *Canvas) SetBrightness(factor float64) error {
	factor = math.Max(-1, factor)
	factor = math.Min(1, factor)

	success := C.MagickModulateImage(self.wand, C.double(100+factor*100.0), C.double(100), C.double(100))

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

	return nil
}
Exemple #2
0
// Adjusts the canvas's hue given a factor (-1.0 thru 1.0)
func (cv Canvas) SetHue(factor float64) bool {

	factor = math.Max(-1, factor)
	factor = math.Min(1, factor)

	status := C.MagickModulateImage(cv.wand, C.double(100), C.double(100), C.double(100+factor*100.0))

	if status == C.MagickFalse {
		return false
	}

	return true
}