how do I specify a transparent background colour on a draw2d Figure?

2.1k Views Asked by At

I'm writing an eclipse plugin, and I'm layering some simple figures (i.e. view elements) together to create diagrams.

A simple component looks like this

A simple component with rendering issues http://img115.yfrog.com/img115/4946/componentwithopacity.jpg

The drum icon on the right is part of a tiny widget drawer.

And the incomplete line underneath it is trying to represent multiplicity, but it's being blocked by the widget drawer.

I tried really hard to get a transparent background on the Figure, but the SWT colour class has no way to specify an alpha or transparent colour.

has anyone run into this problem before? How can I make my draw2d Figure background transparent so I can see stuff behind it.

This a small example of various other opacity related issues I've encountered. Solving this would fix a wide range of visual issues.

Any help is greatly appreciated. CV

2

There are 2 best solutions below

1
On BEST ANSWER

So IFigure.setOpaque(false) doesn't do it?

0
On

Simply set the alpha from 0 to 255 to your liking. See Graphics#setAlpha(int) during your paint event or see Shape - I think setAlpha(int) exists there too.