Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » draw2d behaves wrongly on Ubuntu 10.10(draw2d: drawing oval/ polygon while scaling is involved shows wrong shapes in ubuntu 10.10)
draw2d behaves wrongly on Ubuntu 10.10 [message #667493] Fri, 29 April 2011 07:27 Go to next message
atieq.rehman is currently offline atieq.rehmanFriend
Messages: 12
Registered: March 2010
Junior Member
using draw2d with swt to draw figures behaves wrongly on ubuntu10.10

i m following the steps to paint figure

1. save the graphics state
2.apply alpha value
3. apply scale on graphics
4. draw oval using GC
5. pop the graphics state

also repeated the same steps for other figures fill rectangle and fill polygon

this gives correct output on window but wrong on ubuntu

A snapshot of differences:

sample code is given blow
import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.LightweightSystem;
import org.eclipse.draw2d.XYLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class DrawTesting {
	public static void main(String[] args) {
		final Display display = new Display();
		Shell shell = new Shell(display);
		shell.setSize(250, 300);;

		LightweightSystem lws = new LightweightSystem(shell);
		IFigure eFigure = new Figure() {
			public void paintFigure(Graphics graphics) {
				int scaleFactor = 64;

				// This does not draw oval properly due to scaling
				// GC->drawOval ->checkGC() at line # 321
				graphics.drawOval(10 * scaleFactor, 10 * scaleFactor, 200 * scaleFactor, 200 * scaleFactor);

				graphics.fillRectangle(10, 10, 200, 200);
				// This poly does not draw at the right position
				// GC->fillPolygon 
				graphics.fillPolygon(new int[]{
						10, 10, 
						210, 10, 
						210, 210,
						10, 210});

		eFigure.setLayoutManager(new XYLayout());
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())

i am using eclipse 3.6

anyone having the reason behind.. it seems that linux implementation might have some issues as everything is working correctly on windows plateform

any comments and suggestions are welcomed

[Updated on: Tue, 03 May 2011 10:06]

Report message to a moderator

Re: draw2d behaves wrongly on Ubuntu 10.10 [message #668611 is a reply to message #667493] Fri, 06 May 2011 12:24 Go to previous message
atieq.rehman is currently offline atieq.rehmanFriend
Messages: 12
Registered: March 2010
Junior Member
any reply ???
Previous Topic:(New to GEF) Tweaking Shapes Example with Labels
Next Topic:How to print draw2d figures to pdf
Goto Forum:

Current Time: Sun Jun 24 00:00:20 GMT 2018

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

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

Back to the top