func main() {
	var d = mandel.NewData(800, 600, -0.7435669, 0.1314023, 0.0022878)

	for subPixel := 1; subPixel <= 16; subPixel++ {
		n := fmt.Sprintf("mandel-subpixel-%03d.png", subPixel*subPixel)
		fmt.Println("Render:", n)
		pi := pngimage.NewPngimage(d.MaxX, d.MaxY, n)
		iterateSubPixelTasks(d, pi, subPixel)
		pi.Save()
	}
}
예제 #2
0
func main() {
	d := mandel.NewData(1024, 800, -0.7435669, 0.1314023, 0.0022878)
	pi := pngimage.NewPngimage(d.MaxX, d.MaxY, "mandel.png")
	it := task.IterateTasks(d, pi)

	for t := range it {
		iter := mandel.Iterate(t.CRe, t.CIm, 1024)
		c := getColor(iter)
		pi.Img.Set(t.X, d.MaxY-t.Y, c)
	}
	pi.Save()
}
func main() {
	var maxIter = 10 * 360
	var d = mandel.NewData(640, 400, -0.7435669, 0.1314023, 0.0022878)

	for colScale := 30; colScale < 360; colScale += 30 {
		for colShift := 0; colShift < colScale; colShift += 6 {

			n := fmt.Sprintf("mandel-scale-%04d-shift-%03d.png", colScale, colShift)
			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, colShift))
			}
			pi.Save()
		}
	}
}
func main() {
	const maxIter = 10 * 360
	var d = mandel.NewData(640, 400, -0.7435669, 0.1314023, 0.0022878)

	var iteration [640][400]int

	fmt.Println("Iterate")
	for y := 0; y < d.MaxY; y++ {
		for x := 0; x < d.MaxX; x++ {
			dx := float64(x) * d.StepX
			dy := float64(y) * d.StepY
			iteration[x][y] = mandel.Iterate(d.UpperLeftRe+dx, d.UpperLeftIm+dy, maxIter)
		}
	}

	var err error
	var c color.Color
	for colorShift := 0; colorShift < 36; colorShift++ {
		n := fmt.Sprintf("mandel-hue-colorshift-%02d.png", colorShift)
		pi := pngimage.NewPngimage(d.MaxX, d.MaxY, n)

		for y := 0; y < d.MaxY; y++ {
			for x := 0; x < d.MaxX; x++ {
				iter := iteration[x][y]
				h := float64((iter+colorShift*10)%360) / 360.0
				if c, err = hue.Color(h); err != nil {
					panic(err)
				}

				pi.Img.Set(x, d.MaxY-y, c)
			}
		}
		fmt.Println("write file", n)
		pi.Save()
	}
}