silvermandel
Over on Steven Engelhardt’s blog there’s a mandelbrot viewer written using silverlight 1.0 (meaning just xaml + javascript). In his post he listed a few problems he had, and one caught my eye:
- I can’t figure out how to do progressive (e.g. line-by-line) rendering to give the user feedback.
I figured this would be pretty easy with the help of setTimeout() and some more global state, so I hacked it together here. Instead of the line by line rendering I implemented a progressive jpg style interlaced rendering, with multiple passes of smaller and smaller pixels. As you can see in the demo, you can mouse over and click while it’s in the middle of rendering, and it’ll start the new render. No more waiting.
One thing he’s doing (that he notes is quite heavyweight) is using rectangles. To lessen the hit, he uses 1 rectangle for many contiguous pixels of the same color on the same line. I’d imagine using an InkPresenter and adding stylus points might be a less heavyweight approach (at least I think it will be in the case of moonlight.)
update: realized how to make mouse events faster - specify IsHitTestVisible=”false” on all the rectangles. That way the event system doesn’t have to worry about generating enter/leave events for each scan line (and for many individual pixels on those scanlines). And speaking of scan lines, add an translucent red indicator line that shows the next line to be drawn. Add more precision (down to pixel_size == 1), and when we’re finished rendering, display how many rectangle children of the main canvas there are (for the first render there are over 13000. that’s a lot of children. moonlight seems to handle it ok too ![]()