Skip to main content



      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
Eclipse UserFriend
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
Eclipse UserFriend
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
Eclipse UserFriend
Yes, I got it. Thanks. Razz
Previous Topic:EditPartViewer setProperty(...) method
Next Topic:Dotted rectangle when selecting a shape.
Goto Forum:
  


Current Time: Tue Jul 15 09:42:08 EDT 2025

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

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

Back to the top