Пример #1
0
func handleChans(im *image.RGBA, ch <-chan point) {
	counter := 0
	pixCount := im.Height() * im.Width()

	for counter < pixCount {
		counter += 1
		p := <-ch
		im.Pixel[p.x][p.y] = p.color
	}
}
Пример #2
0
func Mandelbrot(im *image.RGBA, lineMin, lineMax int, vpx, vpy, d float64, ch chan<- point) {
	width := float64(im.Width())
	height := float64(im.Height())
	for i := lineMin; i < lineMax; i++ {
		for j := 0; j < im.Height(); j++ {
			x0 := float64(i)/(width/d) - d/2.0 + vpx
			y0 := float64(j)/(height/d) - d/2.0 + vpy
			ch <- point{i, j, getPixelAt(y0, x0)}
		}
	}
}