diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-10-26 10:39:43 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-10-26 10:39:43 -0400 |
commit | 1efbabec9e6e0863d6c5796b9a5cba2871cad2cc (patch) | |
tree | c444e1935792581d33dc893cae5d5bb7cabe4a98 /src/renderer.jl | |
parent | f6438aa63834ed6ed577863133d2ca01700f2f1f (diff) | |
download | julia-fractals-1efbabec9e6e0863d6c5796b9a5cba2871cad2cc.tar.gz julia-fractals-1efbabec9e6e0863d6c5796b9a5cba2871cad2cc.zip |
start moving logic out into a separate renderer
Diffstat (limited to 'src/renderer.jl')
-rw-r--r-- | src/renderer.jl | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/renderer.jl b/src/renderer.jl new file mode 100644 index 0000000..2fe3ffd --- /dev/null +++ b/src/renderer.jl @@ -0,0 +1,17 @@ +using Tk +using Images +using ImageView +using Color + +function render(imgc, iterations = 45, make_c = z -> z, step = (z, c) -> z.^2 + c) + imgsize = get_size(canvas(imgc)) + img = [ HSV(0, 0, 0) for x=1:imgsize[2], y=1:imgsize[1] ] + f = FractalExplorer.Fractal{Float64}((imgsize[2], imgsize[1]), make_c, step) + + for i = 1:iterations + FractalExplorer.step(f) + new_pixels = (abs(f.z) .> 2) & (img .== HSV(0, 0, 0)) + img[new_pixels] = HSV(i * 360/iterations, 1, 1) + view(imgc, img) + end +end |