Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » Transparent Canvas inside a composite parent (How to make the canvas transparent so that they cannot be differentiated from the composite)
Transparent Canvas inside a composite parent [message #1768778] Sun, 23 July 2017 19:48 Go to next message
Sudharshan Gopikrishnan is currently offline Sudharshan GopikrishnanFriend
Messages: 15
Registered: April 2017
Junior Member
Hello all,

I am using Nebula visualization widgets in my projects. The widgets are created on top of a canvas. The canvas sits on the top of a composite parent.

The problem i face is that, the canvas can be clearly differentiated from the underlying composite parent. I want to make them indifferentiable.

The Code I am using :


Composite comp = new Composite(folder, SWT.None);

GridLayout layout = new GridLayout();
layout.numColumns = 4;
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
comp.setLayout(layout);

// creating canvases to hold the widgets.
Canvas knobCanvas = new Canvas(comp, SWT.BORDER);
knobCanvas.setLayoutData(gd);

Canvas gaugeCanvas = new Canvas(comp, SWT.BORDER);
gaugeCanvas.setLayoutData(gd);

Canvas thermoCanvas = new Canvas(comp, SWT.BORDER);
thermoCanvas.setLayoutData(gd);

Canvas tankCanvas = new Canvas(comp, SWT.BORDER);
tankCanvas.setLayoutData(gd);

Canvas knobCanvas1 = new Canvas(comp, SWT.BORDER);
knobCanvas1.setLayoutData(gd);

// use LightweightSystem to create the bridge between SWT and draw2D
LightweightSystem lws = new LightweightSystem(knobCanvas);

// Create widgets
final KnobFigure knobFigure = new KnobFigure();
lws.setContents(knobFigure);

lws = new LightweightSystem(gaugeCanvas);
final GaugeFigure gauge = new GaugeFigure();
gauge.setBackgroundColor(XYGraphMediaFactory.getInstance().getColor(0, 0, 0));
gauge.setForegroundColor(XYGraphMediaFactory.getInstance().getColor(255, 255, 255));
lws.setContents(gauge);

lws = new LightweightSystem(thermoCanvas);
final ThermometerFigure thermo = new ThermometerFigure();
lws.setContents(thermo);

lws = new LightweightSystem(tankCanvas);
final TankFigure tank = new TankFigure();
lws.setContents(tank);

lws = new LightweightSystem(knobCanvas1);
final KnobFigure knobFigure1 = new KnobFigure();
lws.setContents(knobFigure1);


I have tried many methods, but none of them work unfortunately. Please see the attached Pic for the reference. What I am trying to do is remove the clearly visible canvas and make them match with the background. Is there any method to make the the canvas transparent? Any help will be appreciated !

Regards,
Sudharshan


Re: Transparent Canvas inside a composite parent [message #1768817 is a reply to message #1768778] Mon, 24 July 2017 07:06 Go to previous messageGo to next message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 432
Registered: July 2009
Senior Member

Hi Sudharshan,

Why create on a canvas? Please see the snippets below.

Best regards,

Wim

http://www.eclipse.org/nebula/snippets.php#Visualization
Re: Transparent Canvas inside a composite parent [message #1769124 is a reply to message #1768817] Wed, 26 July 2017 20:30 Go to previous messageGo to next message
Sudharshan Gopikrishnan is currently offline Sudharshan GopikrishnanFriend
Messages: 15
Registered: April 2017
Junior Member
Hello Wim,

The reason I used a canvas was because, I had to work with a composite parent. In the examples snippets, they use a shell and associate the LightweightSystem with the shell. Whereas In my case, If I use a shell, I wont be able to connect to my composite. Hence I used the canvas. Please let me know if there are any other alternatives where I can use my widgets through a composite parent.

Thank you for your time.

Regards,
Sudharshan
Re: Transparent Canvas inside a composite parent [message #1769126 is a reply to message #1769124] Wed, 26 July 2017 20:51 Go to previous message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 432
Registered: July 2009
Senior Member

Try a composite.

Cheers,

Wim
Previous Topic:Eclipse unable to resolve import statement
Next Topic:Transparent pixels in IntensityGraphFigure
Goto Forum:
  


Current Time: Wed Sep 26 04:24:21 GMT 2018

Powered by FUDForum. Page generated in 0.02619 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top