Esempio n. 1
0
func (this *Gradient) Interpolate(col *Color24, factor Double) {
	factor = util.Clamp01(factor)
	index = this.findIntervalIndexOfFactor(factor)
	newfactor = this.projectFactorIntoInterval(factor, index)
	a, b = this.colors[index], this.colors[index+1]
	col.R = uint8(Double(a.R) + (Double(b.R)-Double(a.R))*newfactor)
	col.G = uint8(Double(a.G) + (Double(b.G)-Double(a.G))*newfactor)
	col.B = uint8(Double(a.B) + (Double(b.B)-Double(a.B))*newfactor)
}
Esempio n. 2
0
func (this *Gradient) Interpolate(factor Double) *Color {
	factor = util.Clamp01(factor)
	var index = this.findIntervalIndexOfFactor(factor)
	var newfactor = this.projectFactorIntoInterval(factor, index)
	return this.colors[index].Interpolated(this.colors[index+1], newfactor)
}