Discussion:
[nebula-dev] New topic in forum Nebula, called Transparent Canvas inside a composite parent , by Sudharshan Gopikrishnan
f***@eclipse.org
2017-07-23 19:48:35 UTC
Permalink
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




To participate in the discussion, go here: https://www.eclipse.org/forums/index.php?t=rview&frm_id=64
Loading...