Mandelbrot renderer with canvas

Hi all,

I was bored and decided to see how the browser handles pixel-level graphics generated with a complex computation. The Mandelbrot set is a perfect example for this, so that’s what I did:

The computation is done in the browser and rendering with canvas. The server side is pretty thin, all it does is set up the layout and pass the fractal parameters to the renderer.

I doubt this will be of any use to anyone, but the source is
in contrib. It also includes a Swing client that can be used to test the fractal generator, which is completely isolated from rendering.

Cool thing :smiley:

But it’s hard to inspect the mandelbrot without mouse controlling. But anyway, nice work :slight_smile:

I revised the Mandelbrot component a bit. Turned out that the fractal computation in javascript was a bottleneck after all, so I rewrote the component to calculate the fractal server-side, and draw directly pixels instead of rects. Also added several other optimizations.

And there is now mouse control: just click on the fractal to center and zoom. Max iteration threshold is dynamically adjusted when zooming.

Chrome 3 is almost 50% faster than FF3.5, but for some reason Chrome draws only a black screen. I think I’ve exhausted my interest in this for now, but patches are more than welcome if someone gets it working on Chrome :slight_smile:

Demo and SVN updated, see the thread root message.

Drawing black is so much less resource intensive than all those glorious colors :slight_smile: Actually - it is probably all black in other WebKit browsers too. At least it was black in Safari 4.0.2.