[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.gef] drawRoundedRectangle doesn't work with AnitAlias activated

Some methods on org.eclipse.draw2d.Graphics doesn't work on "Linux" if
antialising has been activated. I had the problem with
draw- & fillRoundedRectangle and with fillGradient.
I'm using cairo-0.1.23!

 public class Snippet {

	public static void main(String args[]) {
		Display d = new Display();
		final Shell shell = new Shell(d);
		shell.setSize(400, 400);
		LightweightSystem lws = new LightweightSystem(shell);
		Figure contents = new Figure();
		XYLayout contentsLayout = new XYLayout();
		contents.setLayoutManager(contentsLayout);

		Figure fig = new Figure() {

			@Override
			protected void paintClientArea(Graphics graphics) {
				graphics.setForegroundColor(ColorConstants.black);
				graphics.drawRoundRectangle(getBounds().shrink(1, 1), 50, 50);
//				graphics.fillGradient(getBounds(), true);
			}


			@Override
			public void paint(Graphics graphics) {
				graphics.setAntialias(SWT.ON);
				super.paint(graphics);
			}

		};
		fig.setBounds(new Rectangle(100, 100, 100, 100));
		contents.add(fig);

		lws.setContents(contents);
		shell.open();
		while (!shell.isDisposed())
			while (!d.readAndDispatch())
				d.sleep();
	}
}