Exemple #1
0
// MapImageTo maps one picture through an IFS onto another.
func (o Affine) MapImageTo(src *canvas.Canvas, dest *canvas.Canvas, k int, done chan int) {
	for i := 0; i < src.Width; i++ {
		x := float64(i) / src.FWidth
		for j := 0; j < src.Height; j++ {
			r, g, b := src.Get(i, j)
			if r > 0 || g > 0 || b > 0 {
				y := float64(j) / src.FHeight
				x2, y2 := o.Apply(x, y)
				dest.FSet(x2, y2, canvas.RGB(r, g, b))
			}
		}
	}
	done <- k
}