On Mon, 2 Jun 2003 06:04:47 -0500 David Faden dfaden@iastate.edu wrote:
The code is for a little Mandelbrot set explorer. It seems pretty slow (compared to similar implementations of the M. set in different environments and compared to other graphics objects within the Squeak image). Is the usual way to create an image pixel-by-pixel in Squeak to create a Form then set the pixels one-by-one using #colorAt: put: or #pixelValueAt: put:? What could I do to improve the performance?
David,
You seem to be doing the traditional algorithm correctly in Squeak. One thing that speeds things up a bit is a different algorithm.
http://www.charm.net/~arning/MandelBob.17Jun431pm.cs
Implements something called the Mariani/Silver algorithm which I lifted from a sample application written in MacApp. This approach examines the edges of rectangle and, when all edge pixels are the same, fills the interior without checking each pixel. I don't know if this has been proven to be correct, but it certainly looks right to the eye and is a good bit faster.
Is there a way to associate an hour glass cursor with a single Morph to allow it indicate that it's carrying out a noticeably time consuming process?
It isn't so much associating an hour glass with a morph as it is showing the hour glass while some code is running. The way to do this is...
Cursor wait showWhile: [your code in here].
Alternatively, you can move the computation to another process and left the user have the use of the computer while it's running. That's the approach I took. If you decide to file in the above code to a recent Squeak image, at leadt one thing needs to change...
!MandelMorph2 methodsFor: 'menu' stamp: 'RAA 6/2/2003 08:34'! mouseDown: evt
(MenuMorph new) add: 'Zoom in' target: self selector: #zoomIn; "--" add: 'Save to disk' target: self selector: #saveToDisk; "--" add: 'Set project background' target: self selector: #setProjectBackground;
"--" popUpAt: Sensor cursorPoint forHand: evt hand in: World. ! !
Cheers, Bob
squeak-dev@lists.squeakfoundation.org