Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Relation between figure bounds and display pixels
Relation between figure bounds and display pixels [message #788013] Wed, 01 February 2012 03:44 Go to next message
Jan Krakora is currently offline Jan Krakora
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
Hi,

I have two rectangles
RectangleFigure figure = new RectangleFigure();
parent.add(figure);
parent.setConstraint(figure, new Rectangle(10, 10, 20, 20));

figure = new RectangleFigure();
parent.add(figure);
parent.setConstraint(figure, new Rectangle(30, 30, 20, 20));
Where the parent has set the XYLayout.

I would expect those rectangles touch each other with theirs corners, but there is one pixel gap between them. Why is that??
Re: Relation between figure bounds and display pixels [message #837975 is a reply to message #788013] Fri, 06 April 2012 07:25 Go to previous messageGo to next message
pawcik Missing name is currently offline pawcik Missing name
Messages: 2
Registered: April 2012
Junior Member
What do you mean by one pixel gap?

When you draw a rectangle with size (10,10) starting from point (10,10) the Graphics will fill the pixels [(10,10),(10,11), ... , (10,19) ], so the line will take exactly 10 pixels space. So if you want another rectangle to overlap with each other then you have to start painting from (10,19).

Maybe attached picture (it is exactly what I got from your code) will explain this better Smile
Re: Relation between figure bounds and display pixels [message #887301 is a reply to message #837975] Sat, 16 June 2012 07:07 Go to previous message
Jan Krakora is currently offline Jan Krakora
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
Yes, I got it. Thanks. Razz
Previous Topic:EditPartViewer setProperty(...) method
Next Topic:Dotted rectangle when selecting a shape.
Goto Forum:
  


Current Time: Tue Sep 02 15:11:44 EDT 2014

Powered by FUDForum. Page generated in 0.01693 seconds