Bug in RoundedRectangle? [message #79180] |
Tue, 13 May 2003 23:41  |
Eclipse User |
|
|
|
Originally posted by: jeff.nospam.com
Been playing around with GEF/draw2d for the past few days, and I have
found a possible bug in the RoundedRectangle figure (or in the underlying
Graphics class). When calling the setCornerDimensions(new Dimension(x,y))
method, if either or both of x or y are odd integers, the figure rendered
has vertical and/or horizontal whitespace in its fill. Try the following:
RoundedRectangle info = new RoundedRectangle();
info.setCornerDimensions(new Dimension(25,25));
info.setLayoutManager(new StackLayout());
info.setBackgroundColor(ColorConstants.lightGray);
info.setOpaque(true);
versus the following:
RoundedRectangle info = new RoundedRectangle();
info.setCornerDimensions(new Dimension(24,24));
...
etc.
Did a quick check of this list and bugzilla and saw nothing directly
related. Should I go ahead and enter into bugzilla?
Details on my platform: Linux (RH7.2), eclipse-2.1 motif
jeff
|
|
|
Re: Bug in RoundedRectangle? [message #79209 is a reply to message #79180] |
Wed, 14 May 2003 00:37   |
Eclipse User |
|
|
|
I tried this on Windows and didn't see the problem you describe. I'll
try it on Linux tomorrow. Here's my testcase.
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.draw2d.*;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Rectangle;
public class RRTest {
public static void main(String[] args) {
Shell shell = new Shell();
shell.setLayout(new FillLayout());
FigureCanvas canvas = new FigureCanvas(shell);
Figure contents = new Figure();
contents.setBackgroundColor(ColorConstants.white);
contents.setOpaque(true);
RoundedRectangle rr1 = new RoundedRectangle();
rr1.setCornerDimensions(new Dimension(25,25));
rr1.setLayoutManager(new StackLayout());
rr1.setBackgroundColor(ColorConstants.lightGray);
rr1.setOpaque(true);
rr1.setBounds(new Rectangle(10, 10, 100, 50));
contents.add(rr1);
RoundedRectangle rr2 = new RoundedRectangle();
rr2.setCornerDimensions(new Dimension(24,24));
rr2.setLayoutManager(new StackLayout());
rr2.setBackgroundColor(ColorConstants.lightGray);
rr2.setOpaque(true);
rr2.setBounds(new Rectangle(120, 10, 100, 50));
contents.add(rr2);
canvas.setContents(contents);
shell.open();
Display display = Display.getDefault();
while (!shell.isDisposed())
if (!display.readAndDispatch())
display.sleep();
display.dispose();
}
}
Jeff Bonevich wrote:
> Been playing around with GEF/draw2d for the past few days, and I have
> found a possible bug in the RoundedRectangle figure (or in the underlying
> Graphics class). When calling the setCornerDimensions(new Dimension(x,y))
> method, if either or both of x or y are odd integers, the figure rendered
> has vertical and/or horizontal whitespace in its fill. Try the following:
>
> RoundedRectangle info = new RoundedRectangle();
> info.setCornerDimensions(new Dimension(25,25));
> info.setLayoutManager(new StackLayout());
> info.setBackgroundColor(ColorConstants.lightGray);
> info.setOpaque(true);
>
> versus the following:
> RoundedRectangle info = new RoundedRectangle();
> info.setCornerDimensions(new Dimension(24,24));
> ...
> etc.
>
> Did a quick check of this list and bugzilla and saw nothing directly
> related. Should I go ahead and enter into bugzilla?
>
> Details on my platform: Linux (RH7.2), eclipse-2.1 motif
>
> jeff
>
|
|
|
Re: Bug in RoundedRectangle? [message #79484 is a reply to message #79209] |
Wed, 14 May 2003 17:44  |
Eclipse User |
|
|
|
I found this to happen on both GTK and Motif. It turns out to be a bug in the
way GC fills its round rectangles. I opened a bug against SWT (#37623).
Eric Bordeau wrote:
> I tried this on Windows and didn't see the problem you describe. I'll
> try it on Linux tomorrow. Here's my testcase.
>
> import org.eclipse.swt.layout.FillLayout;
> import org.eclipse.swt.widgets.Display;
> import org.eclipse.swt.widgets.Shell;
>
> import org.eclipse.draw2d.*;
> import org.eclipse.draw2d.geometry.Dimension;
> import org.eclipse.draw2d.geometry.Rectangle;
>
> public class RRTest {
>
> public static void main(String[] args) {
> Shell shell = new Shell();
> shell.setLayout(new FillLayout());
>
> FigureCanvas canvas = new FigureCanvas(shell);
> Figure contents = new Figure();
> contents.setBackgroundColor(ColorConstants.white);
> contents.setOpaque(true);
>
> RoundedRectangle rr1 = new RoundedRectangle();
> rr1.setCornerDimensions(new Dimension(25,25));
> rr1.setLayoutManager(new StackLayout());
> rr1.setBackgroundColor(ColorConstants.lightGray);
> rr1.setOpaque(true);
> rr1.setBounds(new Rectangle(10, 10, 100, 50));
> contents.add(rr1);
>
> RoundedRectangle rr2 = new RoundedRectangle();
> rr2.setCornerDimensions(new Dimension(24,24));
> rr2.setLayoutManager(new StackLayout());
> rr2.setBackgroundColor(ColorConstants.lightGray);
> rr2.setOpaque(true);
> rr2.setBounds(new Rectangle(120, 10, 100, 50));
> contents.add(rr2);
>
> canvas.setContents(contents);
>
> shell.open();
> Display display = Display.getDefault();
> while (!shell.isDisposed())
> if (!display.readAndDispatch())
> display.sleep();
> display.dispose();
> }
>
> }
>
>
> Jeff Bonevich wrote:
>
>> Been playing around with GEF/draw2d for the past few days, and I have
>> found a possible bug in the RoundedRectangle figure (or in the underlying
>> Graphics class). When calling the setCornerDimensions(new
>> Dimension(x,y))
>> method, if either or both of x or y are odd integers, the figure rendered
>> has vertical and/or horizontal whitespace in its fill. Try the
>> following:
>>
>> RoundedRectangle info = new RoundedRectangle();
>> info.setCornerDimensions(new Dimension(25,25));
>> info.setLayoutManager(new StackLayout());
>> info.setBackgroundColor(ColorConstants.lightGray);
>> info.setOpaque(true);
>>
>> versus the following:
>> RoundedRectangle info = new RoundedRectangle();
>> info.setCornerDimensions(new Dimension(24,24));
>> ...
>> etc.
>>
>> Did a quick check of this list and bugzilla and saw nothing directly
>> related. Should I go ahead and enter into bugzilla?
>>
>> Details on my platform: Linux (RH7.2), eclipse-2.1 motif
>>
>> jeff
>>
>
|
|
|
Powered by
FUDForum. Page generated in 0.05900 seconds