[Q][balloon2D] is transparency supported?

Boris Gaertner Boris.Gaertner at gmx.net
Fri Feb 25 16:21:34 UTC 2005


----- Original Message -----
From: "Baveco, Hans" <Hans.Baveco at wur.nl>
To: <squeak-dev at lists.squeakfoundation.org>
Sent: Friday, February 25, 2005 4:26 PM
Subject: [Q][balloon2D] is transparency supported?


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..

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




More information about the Squeak-dev mailing list