Image size / PS: alpha-blend

Dan Ingalls DanI at wdi.disney.com
Mon Nov 30 07:06:11 UTC 1998


Andres -

>I'm still using Squeak 2.0. I was doing something with function plotters 
>and I wanted to make alpha-blending while drawing. My video card is set up at a 
>bitdepth of 16, and so was the image. But I had to make the image bitdepth 
>32 for alpha blending to work. Correspondingly, the image size went up by over 
>4mb. But the video card was still set up at a bitdepth of 16, so bitmap 
>bitdepth crunching was being performed somewhere. After I finished the thing, and 
>noticing that display speed was much slower (maybe due to such bitdepth 
>crunching), I closed the morph worlds and set the display depth back to 16. But 
>the image never got smaller, and the screen updating did not recover its 
>original speed. I tried a bitdepth of 8, but the image didn't recover its original 
>size.
>
>Where should I take a look to see what's going on?

Try this...

     Paragraph allInstancesDo:
          [:p | (p destinationForm class == DisplayScreen
               and: [p destinationForm ~~ Display])
               ifTrue: [p destinationForm: nil]]

I discovered a couple of months ago that the label paragraphs of some MVC windows (mainly project views after relabelling) can hold onto the global display object.  Since this changes from time to time (as, for instance, when you change display depth, change projects, etc), you can end up with lots of (I had 7) extra instances of DisplayScreen.  At 1.2MB a pop, this gets expensive (plus, they don't get compressed).

I believe I fixed this in 2.2.

	- Dan

P.S.  Have you looked at the alpha-blend drawing demos in Squeak?  They actually provide a sliding 32-bit buffer with alpha blending and anti-aliasing for sketching.  The screen depth can even be 8 bits and they work.

Try...
	Display restoreAfter: [BitBlt alphaBlendDemo]
and...
	Display restoreAfter: [BitBlt antiAliasDemo]

Each of these puts something on the screen and then goes into scribble mode until you hit option-click.

Also, note that Squeak 2.2 introduced a new bitBlt mode supporting copyBits of any source form at a given alpha value into EITHER 16 or 32 bits, so you can do some alpha blend experiments now without having to go to 32 bits.

Try the example comments in BitBlt>>copyBits: sourceForm at: destOrigin translucent: factor
and BitBlt>>paintBits: sourceForm at: destOrigin translucent: factor.
Note that your display must be in 16 or 32 bits for these to work.





More information about the Squeak-dev mailing list