By: Steve Waring
Home Pages: Journal Dolphinharbor
Created: 20020923
Last Update: 20021014
Article overview
This weekends diversion was to play around with Bitmaps.
I found some code at codeproject, Really cool visual FX and decided to have a go at porting some of it to Smalltalk. The demo executable is worth a look. I really wanted the "Water" effect, but the "Fire" effect looked quicker to port.
The initial port was an ugly mess of C++ translated to Smalltalk. I had numerous off by one bugs to track down, but eventually got it working:

It was slow even at the smaller sizes. I spent some time profiling and converting all ByteArray and ExternalMemory accesses to primative methods. At the size in the screenshot above, the animation looks great, but on larger bitmaps it is still too slow.
I didnt attempt the "Water" effect. It seems to get down to doing bit-level manipulation, and I think I would be waiting a while to see a ripple. Not the right tool for the job but it would be interesting to see how it would run in VW. I had hoped to use the "Water" effect for a Splash screen for a project I am currently working on ...
Instead of doing the Alpha Blending in Smalltalk, I decided to try the Win32 functions. I couldnt see a way to do animations like the above, the Win32 functions blend two bitmaps, while the BmFireRoutine class modifies a data array to simulate the fire, and uses that to alpha-blend a palette color with the bitmap bytes.
I did come up with a new view/ImagePresenter resource that is effectively a combination of DoubleBufferedView and DolphinSplash with a <ValueConvertingControlView> protocol. Using this view resource, if you set an image into an ImagePresenter's valueModel, it will do an Alpha-Blend fade from the previous value image to the new image. Good fun, and could be useful for a project I am working on.
If anybody wants the code, please email me.
Thats about it for this weekends diversion ... well except for trying out Userland's Radio :)
Make your CHB transparent
By Adding these methods:
And evaluating (or using flipper)
Note:Win2K only ... please only use an image you can afford to trash.
... Coming soon!
Copyright Steve Waring 2002.