Skip to main content


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 08:44 Go to next message
Jan Krakora is currently offline Jan KrakoraFriend
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 11:25 Go to previous messageGo to next message
pawcik Missing name is currently offline pawcik Missing nameFriend
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 11:07 Go to previous message
Jan Krakora is currently offline Jan KrakoraFriend
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: Thu Apr 25 17:17:30 GMT 2024

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

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

Back to the top