2

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

CVertex
  • 17,997
  • 28
  • 94
  • 124

2 Answers2

4

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

Jonathan Feinberg
  • 44,698
  • 7
  • 80
  • 103
  • hahaha! I did try that! but I was using draw2d Panels, which override isOpaque with always true. so setOpaque was getting ignored. I changed all my container Figures to just Figure and bam, the widget is see through! Thank you! – CVertex Dec 13 '09 at 19:27
2

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.

andyczerwonka
  • 4,230
  • 5
  • 34
  • 57