diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-10-23 13:58:56 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-10-23 13:58:56 -0400 |
commit | 1ed7867027f00b8ee9c264656a028a22350b5f62 (patch) | |
tree | e6a373fb3da279f7b03574c8b0e231c2135691d8 | |
download | julia-fractals-1ed7867027f00b8ee9c264656a028a22350b5f62.tar.gz julia-fractals-1ed7867027f00b8ee9c264656a028a22350b5f62.zip |
initial commit
-rw-r--r-- | fractal.jl | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/fractal.jl b/fractal.jl new file mode 100644 index 0000000..e46b8ba --- /dev/null +++ b/fractal.jl @@ -0,0 +1,33 @@ +using Tk +using Images +using ImageView + +mandelbrot(z, c) = z.^2 + c + +img = [ Color.HSV(0, 0, 0) for x=1:1000, y=1:1000 ] +c = [ x + y*im for x=linspace(-2, 2, 1000), y=linspace(-2, 2, 1000) ] +z = c + +imgc, imgslice = view(img) + +for i = 1:90 + z = mandelbrot(z, c) + img[abs(z) .> 50] = Color.HSV(i * 4, 1, 1) + view(imgc, img) +end + +#If we are not in a REPL +if (!isinteractive()) + + # Create a condition object + c = 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(c)) + + # Wait for the notification before proceeding ... + wait(c) +end |