Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » [draw2d] Dashed lines with antialiasing(It looks like there is a bug when using antialiasing with custom line dash in a Polyline figure : the line is drawn continuous.)
[draw2d] Dashed lines with antialiasing [message #500691] Fri, 27 November 2009 14:24 Go to next message
Gilles is currently offline GillesFriend
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
Re: [draw2d] Dashed lines with antialiasing [message #501202 is a reply to message #500691] Tue, 01 December 2009 14:23 Go to previous messageGo to next message
Gilles is currently offline GillesFriend
Messages: 3
Registered: November 2009
Junior Member
Anybody could at least confirm that the behaviour is reproducible?

Thanks a lot,

Gilles
Re: [draw2d] Dashed lines with antialiasing [message #501641 is a reply to message #501202] Thu, 03 December 2009 08:51 Go to previous message
Gilles is currently offline GillesFriend
Messages: 3
Registered: November 2009
Junior Member
For information, the problem is solved by adding line.setLineStyle(SWT.LINE_CUSTOM);

Otherwise, there's a mix of "advanced mode" and "normal mode" and the painting of the dash doesn't work.

[Updated on: Thu, 03 December 2009 08:52]

Report message to a moderator

Previous Topic:GEF/Draw2D installation on Mac OS Snow Leopard
Next Topic:Newly created connection doesn't use the anchor that is provided
Goto Forum:
  


Current Time: Mon Nov 24 01:43:36 GMT 2014

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

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