summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-10-25 10:40:45 -0400
committerJesse Luehrs <doy@tozt.net>2014-10-25 10:40:45 -0400
commitdb71559b6c1cd5a09f53996f244a0486a5bc6744 (patch)
treefb15b91c19294210dda4587136e7d77e38366fb7
parent98292bb163c83b9d2472e286a4e5d034cff028ce (diff)
downloadjulia-fractals-db71559b6c1cd5a09f53996f244a0486a5bc6744.tar.gz
julia-fractals-db71559b6c1cd5a09f53996f244a0486a5bc6744.zip
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
-rw-r--r--examples/mandelbrot.jl3
1 files changed, 2 insertions, 1 deletions
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