[draw2d] Dashed lines with antialiasing [message #500691] |
Fri, 27 November 2009 14:24 |
Gilles Messages: 3 Registered: November 2009 |
Junior Member |
|
|
Hello all,
I'm using the latest build of GEF 3.5.0.v20090525-1511 and draw2d 3.5.1.v20090813-1341. It looks like there is a little problem with the Polyline class, as I have to choose between antialiasing and line dash. Here is a reproducer :
import org.eclipse.draw2d.LightweightSystem;
import org.eclipse.draw2d.Polyline;
import org.eclipse.draw2d.RectangleFigure;
import org.eclipse.draw2d.geometry.PointList;
import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
public class Draw2DSample extends ApplicationWindow {
/*
* (non-Javadoc)
* @see org.eclipse.jface.window.Window#createContents(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createContents(Composite parent) {
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(new FillLayout());
Canvas canvas = new Canvas(composite, SWT.NULL);
LightweightSystem lws = new LightweightSystem(canvas);
RectangleFigure figure = new RectangleFigure();
Polyline line = new Polyline();
line.setPoints(new PointList(new int[] { 0, 0, 100, 65 }));
line.setAntialias(SWT.ON);
line.setLineDash(new float[] { 5.0f, 5.0f });
figure.add(line);
lws.setContents(figure);
return composite;
}
/**
* @param parentShell
*/
public Draw2DSample(Shell parentShell) {
super(parentShell);
}
public static void main(String[] args) {
Draw2DSample window = new Draw2DSample(null);
window.setBlockOnOpen(true);
window.open();
}
}
... here the line should be dashed, but it is drawn continuous. If you remove the line "line.setAntialias(SWT.ON), the line is dashed.
Someone has experienced this? Am I doing something wrong? Or do you think it's a bug and I have to file it?
Thanks by advance,
Gilles
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02972 seconds