Пример #1
0
func TestPixelTasks(t *testing.T) {
	pi := pngimage.NewPngimage(16, 9, "image.png")
	d := mandel.NewData(1024, 800, -0.7435669, 0.1314023, 0.0022878)
	it := task.IterateTasks(d, pi)

	if len(it) != 16*9 {
		t.Errorf("len(%v) = %v, want %v", it, len(it), 16*9)
	}

}
func main() {
	var maxIter = 10 * 360
	var d = mandel.NewData(640, 400, -0.7435669, 0.1314023, 0.0022878)

	for colScale := 30; colScale < 120; colScale += 30 {

		n := fmt.Sprintf("mandel-hue-%04d.png", colScale)
		fmt.Println("Render:", n)
		pi := pngimage.NewPngimage(d.MaxX, d.MaxY, n)
		it := task.IterateTasks(d, pi)

		for t := range it {
			iter := mandel.Iterate(t.CRe, t.CIm, maxIter)
			pi.Img.Set(t.X, d.MaxY-t.Y, getColor(iter, colScale))
		}
		pi.Save()
	}
}