[Zest] Drawing grahics on a graph [message #902796] |
Mon, 20 August 2012 09:32  |
Eclipse User |
|
|
|
I think I have seen this question being mentioned somewhere else but there was no good solution to it.
The issue is that when drawing something (rectangle, drawline) on a graph and thereafter adding nodes the old drawings will disappear from being overpainted. The drawing for these shapes is done in a paintEvent. It possibly have something to do with the redrawing of figureCanvas (?)
I saw a 'dirty' solution to this in where one would make the drawings in a composite parent and place a transparent graph over that so that the drawings would be placed under the nodes.
Also, as suggested as a solution, making the graph's background transparant only gives me a empty background (this is not black)
Color c1 = new Color(Display.getDefault(), 50, 50, 200);
graph = new Graph(parent, SWT.NONE);
parent.setBackground(c1);
graph.getLightweightSystem().getRootFigure().setOpaque(false);
[Updated on: Mon, 20 August 2012 09:38] by Moderator
|
|
|
|
Re: [Zest] Drawing grahics on a graph [message #903548 is a reply to message #903254] |
Fri, 24 August 2012 04:56  |
Eclipse User |
|
|
|
Hi,
I don't use the Zest, but in draw2D you can convert the relative coordinates to absolute coordinates using figure.translateToAbsolute().
So if you know the graph's main figure bounds, call graph.translateToAbsolute(graph.getBounds().getLocation()) in the paintControl().
|
|
|
Powered by
FUDForum. Page generated in 0.23877 seconds