Home » Eclipse Projects » Standard Widget Toolkit (SWT) » GC Draw/Fill methods inconsistency ?
GC Draw/Fill methods inconsistency ? [message #450736] |
Thu, 17 February 2005 09:53 |
Bertrand Boudaud Messages: 1 Registered: July 2009 |
Junior Member |
|
|
Hi,
We get a strange behavior while drawing some shapes using GC's methods. It
seems there are some inconsistency when you draw a bordered shape, and then
the filled version with the same parameters. Please take a look at the
attached picture, by zooming you can see that the filled version of the
shape is drawn upon the border in the left, but not the right side.
For drawRectangle, Specs says that " The left and right edges of the
rectangle are at rect.x and rect.x + rect.width. The top and bottom edges
are at rect.y and rect.y + rect.height." which is a clear statement, and
that corresponds to what we get. But specs says nothing for the filled
version.
Is this behavior platform specific? sorry i didn't took time to test it on
other platform than win32.
The resulting problems of that are:
What result should we expect on other platform?
How other platform implementers should code the GC's drawing methods?
Isn't there an inconsistency to make drawRectangle(myRect) and then a
fillRectangle(myRect), and get the result we can see on the attached
picture?
Or is it just a defect (even specs defect) to report?
bertrand
---
here the code to reproduce the picture
---
public void paintControl(GC gc) {
gc.setLineWidth(1);
gc.setLineWidth(1);
// ------------ ARC
gc.drawRectangle(100,100,100,200);
gc.drawArc(100,100,100,200,-30,350);
gc.fillArc(100,100,100,200,-30,350);
gc.drawRectangle(300,100,100,100);
gc.drawArc(300,100,100,100,-30,350);
gc.fillArc(300,100,100,100,-30,350);
// ----------- Rectangle
gc.drawRectangle(500,100,100,100);
gc.fillRectangle(500,100,100,100);
Rectangle r1=new Rectangle(700,100,100,100);
gc.drawRectangle(r1);
gc.fillRectangle(r1);
// -------------- Polygon
int[] w2 ={200,400,300,400,50,250,50,500,350,500,350,250};
gc.drawPolygon(w2);
gc.fillPolygon(w2);
// ------------- RoundRectangle
gc.drawRoundRectangle(400,300,100,150,20,20);
gc.fillRoundRectangle(400,300,100,150,20,20);
// ------------ Oval
gc.drawRectangle(530,300,100,200);
gc.drawOval(530,300,100,200);
gc.fillOval(530,300,100,200);
gc.drawRectangle(650,300,100,100);
gc.drawOval(650,300,100,100);
gc.fillOval(650,300,100,100);
}
-
Attachment: drawFill.png
(Size: 8.56KB, Downloaded 106 times)
|
|
|
Re: GC Draw/Fill methods inconsistency ? [message #450850 is a reply to message #450736] |
Fri, 18 February 2005 15:22 |
Steve Northover Messages: 1636 Registered: July 2009 |
Senior Member |
|
|
This behavior is consistent on all platforms. It is based on the X Windows
drawing model.
"Bertrand Boudaud" <EXT-Bertrand.Boudaud@nokia.com> wrote in message
news:cv1piv$lu4$1@www.eclipse.org...
>
> Hi,
>
> We get a strange behavior while drawing some shapes using GC's methods. It
> seems there are some inconsistency when you draw a bordered shape, and
then
> the filled version with the same parameters. Please take a look at the
> attached picture, by zooming you can see that the filled version of the
> shape is drawn upon the border in the left, but not the right side.
>
> For drawRectangle, Specs says that " The left and right edges of the
> rectangle are at rect.x and rect.x + rect.width. The top and bottom edges
> are at rect.y and rect.y + rect.height." which is a clear statement, and
> that corresponds to what we get. But specs says nothing for the filled
> version.
>
> Is this behavior platform specific? sorry i didn't took time to test it on
> other platform than win32.
>
> The resulting problems of that are:
> What result should we expect on other platform?
> How other platform implementers should code the GC's drawing methods?
> Isn't there an inconsistency to make drawRectangle(myRect) and then a
> fillRectangle(myRect), and get the result we can see on the attached
> picture?
> Or is it just a defect (even specs defect) to report?
>
>
> bertrand
>
> ---
> here the code to reproduce the picture
> ---
>
> public void paintControl(GC gc) {
>
> gc.setLineWidth(1);
>
> gc.setLineWidth(1);
>
> // ------------ ARC
> gc.drawRectangle(100,100,100,200);
> gc.drawArc(100,100,100,200,-30,350);
> gc.fillArc(100,100,100,200,-30,350);
>
> gc.drawRectangle(300,100,100,100);
> gc.drawArc(300,100,100,100,-30,350);
> gc.fillArc(300,100,100,100,-30,350);
>
> // ----------- Rectangle
> gc.drawRectangle(500,100,100,100);
> gc.fillRectangle(500,100,100,100);
>
> Rectangle r1=new Rectangle(700,100,100,100);
> gc.drawRectangle(r1);
> gc.fillRectangle(r1);
>
> // -------------- Polygon
> int[] w2 ={200,400,300,400,50,250,50,500,350,500,350,250};
> gc.drawPolygon(w2);
> gc.fillPolygon(w2);
>
> // ------------- RoundRectangle
> gc.drawRoundRectangle(400,300,100,150,20,20);
> gc.fillRoundRectangle(400,300,100,150,20,20);
>
>
> // ------------ Oval
> gc.drawRectangle(530,300,100,200);
> gc.drawOval(530,300,100,200);
> gc.fillOval(530,300,100,200);
>
> gc.drawRectangle(650,300,100,100);
> gc.drawOval(650,300,100,100);
> gc.fillOval(650,300,100,100);
>
> }
>
>
>
|
|
|
Goto Forum:
Current Time: Fri Apr 26 15:46:06 GMT 2024
Powered by FUDForum. Page generated in 0.02853 seconds
|