diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-10-24 11:45:40 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-10-24 11:45:40 -0400 |
commit | 35c239e4b7ab489961a0029a53b505921f230244 (patch) | |
tree | 2d3bb08ba6397144417835f44a16249fc51c7adb /examples | |
parent | 1bcf21a6fda4164c2002975b4f3e0f6786abd84d (diff) | |
download | julia-fractals-35c239e4b7ab489961a0029a53b505921f230244.tar.gz julia-fractals-35c239e4b7ab489961a0029a53b505921f230244.zip |
start factoring out into modules
Diffstat (limited to 'examples')
-rw-r--r-- | examples/mandelbrot.jl | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/examples/mandelbrot.jl b/examples/mandelbrot.jl new file mode 100644 index 0000000..417291d --- /dev/null +++ b/examples/mandelbrot.jl @@ -0,0 +1,36 @@ +using Tk +using Images +using ImageView + +using Fractal + +iterations = 45 +imgsize = 500 + +img = [ Color.HSV(0, 0, 0) for x=1:imgsize, y=1:imgsize ] +c = Fractal.complexplane(4.0, imgsize) +z = c + +imgc, imgslice = view(img) + +for i = 1:iterations + z = Fractal.mandelbrot(z, c) + img[abs(z) .> 2] = Color.HSV(i * 360/iterations, 1, 1) + view(imgc, img) +end + +#If we are not in a REPL +if (!isinteractive()) + + # Create a condition object + cv = Condition() + + # Get the main window (A Tk toplevel object) + win = toplevel(imgc) + + # Notify the condition object when the window closes + bind(win, "<Destroy>", e->notify(cv)) + + # Wait for the notification before proceeding ... + wait(cv) +end |