[squeak-dev] using color tables with forms and bitblt?

Lawson English lenglish5 at cox.net
Fri Aug 3 23:30:43 UTC 2012


OK, I'm such a noob here, that I'm not quite sure how to ask my question...


I have a "dwell file" -an array of values generated by a Mandelbrot Set 
application, one per pixel, with arbitrary values between 1 and 
xxxxxxxxxxx (currently less than 2 billion, and right now far less than 
1,000,000)- and I would like to use them, suitably tweaked, as indices 
into a ColorMap. The ColorMap need not have 1,000,000 entries. No-one 
can see that many color differences in a Mandelbrot set anyway.

I can generate an array of Color (ColorArray?) but I'm not sure how to 
use them to create the ColorMap, and I'm not sure how to use the 
ColorMap to speedily change what is drawn in the first place.

Right now, I'm creating a color dictionary and drawing via:


1 to: 800 do: [:y|
     1 to: 800 do: [:x| |i|
         i := x+ ((y-1) *800).  aForm colorAt: x at y put:( myDictColors 
at:  (myArray at: i )).]
         ].


where myDictColors is a dictionary whose keys are the dwells listed in 
the dwell array file and whose values are Color objects from my array of 
colors.

Drawing the above takes about 1.5 seconds, which is a bit slow. I'd like 
realtime-ish updating as I play with colors in the palette. Can this be 
done, at least up to the 4096 color limit that BitBlt has for ColorMaps?

If so, how?  I've been trying to figure out the various classes and I'm 
stumped.


Thanks





-- 
Squeak from the very start (introduction to Squeak and Pharo Smalltalk for the (almost) complete and compleate beginner).
https://www.youtube.com/playlist?list=PL6601A198DF14788D&feature=view_all



More information about the Squeak-dev mailing list