Speeding up an program to create a mandelbrot set
Hi,
For fun I decided to create code to paint the mandelbrot set onto a canvas using the Java2D API.
Unfortunately, if I try making the canvas large (e.g. 800x600 pixels) refreshing is really slow.
Is there any way to speed this up? Every time I move / resize / do anything, the screen repaints, taking all that time to render the graphic.
Is there any way to paint to a file, and then when the image is done reloading, just load the image? Seems like it could be a little quicker once the image renders.
Also, my code is basically:
if (escapein == 0){
// the value never escapes orbit
g2.setPaint(Color.BLACK);
g2.drawLine(x,y,x,y);
}else{
// set the color to paint the pixel based on how many iterations it takes to escape
g2.setPaint(new Color(0,0,(int) (((double) escapein / (double) 50) * 200) + 55));
g2.drawLine(x,y,x,y);
}
Is there a quicker way to render the image than using the drawline method to draw each pixel?
I know my question seems kind of open ended, but really I'm just looking for suggestions on what I can do next. It's taken a lot of work to figure out how to create this, but now that I have it, what can I do to improve it / speed it up?

