[ENH]Translucent forms in 16 bit screen depth Re: [Etoys] Trash icon

karl karl.ramberg at chello.se
Fri Dec 15 09:23:00 EST 2006

Karl skrev:
> Karl wrote:
>> Bert Freudenberg wrote:
>>> On Dec 13, 2006, at 17:39 , karl wrote:
>>>> Bert Freudenberg skrev:
>>>>> On Dec 13, 2006, at 16:14 , karl wrote:
>>>>>> I made a new icon for the trashcan trying to be in line with the 
>>>>>> OPLC HIG.
>>>>>> What do people think ?
>>>>> Not bad I think - a bit small, though. You must not ever use 
>>>>> one-pixel lines, and all the official icons are antialiased. Also, 
>>>>> they typically have only one line width throughout.
>>>> What display depth is the laptop running ? I noticed that my OPLC 
>>>> image was set to 16 bit color depth. Translucency does not work 
>>>> with images for that depth as far as I know, so there can not be 
>>>> antialias against the background. Or do you know a way to do that ?
>>>> I can see that text has antialias at 16 bit color depth, so it must 
>>>> be possible... :-)
>>> Ah, you're right, we're running at 16 bpp. Given the high resolution 
>>> we might get away without AA. Text rendering is a special case ...
>>> - Bert -
>> Using Form combination rule 34 will allow translucent forms to blend 
>> in 8 and 16 bit as well (look at attached screenshot), but there are 
>> some not so nice side effect with other forms, (look at the menu icon 
>> in the screenshot) :-(
>> Some refactoring or regeneration of the forms in the image is nessesary. 
> And exporting a 16 bit depth screenshot as png does not work ;-)
> Here again as bmp.
> Karl
> ------------------------------------------------------------------------
> _______________________________________________
> Etoys mailing list
> Etoys at laptop.org
> http://mailman.laptop.org/mailman/listinfo/etoys
Here is a change set that  make translucency in forms possible for 
screen depth less than 32.
It will use form combination rule 34 if screen depth is less than 32 and 
the form is of depth 32.
It will not work for a rotated form, as I'm not sure yet how to hack 
FormCanvas transformation methods.
But then again translucency does not work with most other rotated morphs 
either ;-)
Can anybody see any other nasty side effects ?

-------------- next part --------------
'From OLPC2.0 of ''24 October 2006'' [latest update: #1141] on 15 December 2006 at 3:09:23 pm'!

!Canvas methodsFor: 'drawing-images' stamp: 'kfr 12/15/2006 14:54'!
translucentImage: aForm at: aPoint sourceRect: sourceRect
	"Draw a translucent image using the best available way of representing translucency.
	Note: This will be fixed in the future."
	self shadowColor ifNotNil:[
		^self stencil: aForm at: aPoint sourceRect: sourceRect color: self shadowColor].
	(self depth < 32 and:[aForm depth > 16])
		ifTrue:[^self image: aForm at: aPoint sourceRect: sourceRect rule: 34].
	(self depth < 32 or:[aForm isTranslucent not]) 
		ifTrue:[^self paintImage: aForm at: aPoint sourceRect: sourceRect].
	self image: aForm
		at: aPoint
		sourceRect: sourceRect
		rule: Form blend! !

More information about the Etoys mailing list