[squeak-dev] Form>asFormOfDepth: appears to break transparency

tim Rowledge tim at rowledge.org
Sat Oct 11 17:54:09 UTC 2014


On 11-10-2014, at 5:00 AM, J. Vuletich (mail lists) <juanlists at jvuletich.org> wrote:
> 
> What do you get if you evaluate:
> 
> f _ Form extent: 8 at 8 depth: 16.
> f32 _ f asFormOfDepth: 32.
> {f colorAt: 1 at 1. f32 colorAt: 1 at 1 }
> 
> If you get transparent twice, then the problem is not in #formOfDepth:, but in your Scratch filters... If that is the case, an alternative to fixing them to support 16bpp would be to do all the stuff in 32bpp.

I get transparent in both cases, but 
a) this is done *before* the scratch filtering in order to make 32bpp forms because the plugin code to do swirlies etc only handles 32bpp. (I’d love to alter this; a move to using 16bpp everywhere in Scratch would benefit the Pi greatly since it is frequently memory bus bound)
b) inspect the two bitmaps; you’ll see that the 8bpp one has 0s but the 32bpp has 16rFF000000s.
c) display each of them with ‘paint’ and you’ll notice that the 32bpp one is black and the 8bpp one is invisible

|f f32|
f := Form extent: 8 at 8 depth: 16.
f32 := f asFormOfDepth: 32.
f displayOn: Display at: 500 at 10 rule: Form paint.
f32 displayOn: Display at: 510 at 10 rule: Form paint.
{f . f32 }

Inspect that to see what I mean.

If I use a hacked asFormOfDepth: that does not do the alpha channel ‘fixing’ then both Forms are transparent. This doesn’t surprise me much since that is what asFormOfDepth: did in Squeak in the ancient days when Scratch was first written by scraping tiny symbols on polished stone slabs.

> 
> Can you prepare an image for us to try? It would help us give better answers.

No need, since this is not stuff I’ve changed (At least.. not knowingly. Always a chance I’ve screwed something up somewhere, of course)
However, the image is available from https://github.com/raspberrypi/scratch/blob/master/NuScratchBeta10.tgz in a package which includes the Pi vm etc. Just shift-click on the top half of the ‘R’ in the Scratch logo and ‘turn fill screen off’ to get to the desktop.


tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Useful Latin Phrases:- Romani quidem artem amatoriam invenerunt. = You know, the Romans invented the art of love.




More information about the Squeak-dev mailing list