Draw2D Bug? [message #247726] |
Mon, 16 March 2009 18:27 |
Eclipse User |
|
|
|
Originally posted by: cayla_sha.gmx.net
Hello!
I`m developing an editor with GMF and for that I draw my nodes with
draw2D. At the moment I use Eclipse 3.5M5 with GEF 3.5.0M5.
I have some nodes where I draw a circle within another graphical form.
The circle should be filled, so I draw the line and then I fill the
circle like this:
public void paintFigure(Graphics graphics) {
super.paintFigure(graphics);
graphics.pushState();
// get the bounds of the node
Rectangle r = getBounds();
int x = r.x + lineWidth / 2;
int y = r.y + lineWidth / 2;
int w = r.width - Math.max(1, lineWidth);
int h = r.height - Math.max(1, lineWidth);
// draw and fill circle
Rectangle circle = new Rectangle(0, 0, w, h);
circle.performTranslate(x, y);
graphics.setForegroundColor(ColorConstants.lightGray);
graphics.drawOval(circle);
graphics.setBackgroundColor(ColorConstants.blue);
graphics.fillOval(circle);
graphics.popState();
}
Looks very normal and easy, but the result doesn`t look normal:
http://i42.tinypic.com/v4ymh2.jpg
(I made the inner circle blue that you can see the difference better;
normally it`s also lightGray.)
The fill-method doesn`t fill the circle entirely. On the bottom right is
a sickle-shaped area which isn`t covered.
I already found a work-around: I make a second circle, which is 1px
higher and wider than the original circle and fill that circle.
But I don`t think this is the way it was intended to be used...
Is this a Bug or am I doing something wrong?
Best wishes
Julia
|
|
|
|
Powered by
FUDForum. Page generated in 0.02911 seconds