From 35c239e4b7ab489961a0029a53b505921f230244 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Fri, 24 Oct 2014 11:45:40 -0400 Subject: start factoring out into modules --- examples/mandelbrot.jl | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 examples/mandelbrot.jl (limited to 'examples') 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, "", e->notify(cv)) + + # Wait for the notification before proceeding ... + wait(cv) +end -- cgit v1.2.3-54-g00ecf