[Q][balloon2D] is transparency supported?

Baveco, Hans Hans.Baveco at wur.nl
Fri Feb 25 19:26:05 UTC 2005


Thanks Boris, 
indeed the code you give below works ok. I guess my problem is that I used a BalloonCanvas on a Form, and later displayed the form with the canvas that is default handed over to a morph, as argument of the drawOn: aCanvas method.
I am a bit confused now, where and how is the canvas defined for a (any) morph, and how can I use a BalloonCanvas to do the final display when e.g. my morph is a submorph of another morph?
 
thanks for your help,
 
Hans

	I wrote:
	

	When displaying polygons on a BalloonCanvas, setting the alpha of the
	fill-color apparently does not work.
	It changes the color though: when alpha approaches 1.0 the original
	color shows, when alpha approaches 0.0 the resulting color approaches
	black/opaque. Is this a known limitation, or a bug.... (the code looks
	like transparency should be handled). The final drawing is done in
	primitives, so a bit difficult to check..
	
	 
	 
	Boris answered:
	In class Translucent we read the following comment:
	
	An alpha of zero is transparent, and 1.0 is opaque.
	This conforms to your results.
	
	The following piece of code is in my opinion correct (in the sense
	that it displays the correct colors.) for all alphas between 0.0 and 1.0
	
	    | bc fs ramp |
	  ramp := (0 to: 360 by: 60) collect:
	      [:h | h / 360.0 -> (Color h: h s: 0.7 v: 0.8 alpha: 0.0)].
	  fs := GradientFillStyle ramp: ramp.
	  fs origin: (10 at 10).
	
	  fs direction: 600 at 300.
	  fs radial: false.
	  bc := BalloonCanvas on: Display.
	  bc aaLevel: 2.
	  bc drawPolygon: (Array with: 10 at 10 with: 500 at 300 with: 300 @500 with: 50 @
	300)
	     fillStyle: fs
	     borderWidth: 2
	     borderColor: ((Color red) alpha: 0.3).
	
	Greetings, Boris
	
	
	

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 5202 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20050225/2c32401f/attachment.bin


More information about the Squeak-dev mailing list