From db71559b6c1cd5a09f53996f244a0486a5bc6744 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 25 Oct 2014 10:40:45 -0400 Subject: only overwrite pixels that haven't been colored yet i was only getting overlapping colors before because the values eventually converge to NaN, which returns false for all comparisons --- examples/mandelbrot.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/mandelbrot.jl b/examples/mandelbrot.jl index a9cfcae..b127d45 100644 --- a/examples/mandelbrot.jl +++ b/examples/mandelbrot.jl @@ -14,7 +14,8 @@ imgc, imgslice = view(img) for i = 1:iterations Fractal.step(m) - img[abs(m.z) .> 2] = Color.HSV(i * 360/iterations, 1, 1) + new_pixels = (abs(m.z) .> 2) & (img .== Color.HSV(0, 0, 0)) + img[new_pixels] = Color.HSV(i * 360/iterations, 1, 1) view(imgc, img) end -- cgit v1.2.3