Article View: borland.public.jbuilder.java.api
Article #3376java.awt.Graphics.drawArc
From: Simon
Date: Thu, 15 Jan 1998 00:00
Date: Thu, 15 Jan 1998 00:00
40 lines
2144 bytes
2144 bytes
I calculated that for a rect 300x200 line drawn at 146 degrees will go through left-top corner of bounding rectangle. When I was drawing arcs using methods shown bellow for any rectangle which is not a square it was drawing an arc's left side shifted more to the left, than expected, as an angle would be greater than specified. On another hand for degrees 90,180,270,360,0 for not square rectangle as well as any degree for arc inside of rectangle which is a square it is drawing arcs perfectly. This is a code I used to draw arcs in paint(....) method of an Applet. g.drawRect(200,200,300,200); g.fillArc(200,200,300,200, 90, 56); // leftmost line of left side of an arc should go through left-top corner if would be prolonged g.drawLine(350,300,200,200); // connect center and left-top rect's point g.drawRect(500,200,200,300); g.fillArc(500,200,200,300, 90, 56); // leftmost line of left side of an arc should go through left-top corner if would be prolonged g.drawLine(600,350,500,200); // connect center and left-top rect's point But when I used to draw an arc with 135 degrees extent than left bound of an arc would go through left-top corner. g.drawRect(200,200,300,200); g.fillArc(200,200,300,200, 90, 45); // leftmost line of left side of an arc should go through left-top corner if would be prolonged g.drawLine(350,300,200,200); // connect center and left-top rect's point Can somebody explain if this is a bug or there are some reason in such an implementation!! In that case if I need to draw an arc starting at iStartDegree degrees extending to iEndDegree degrees with a bounding rectagle 300x200 what should I specify in drawArc(....)? Simon.
Technical Details
Message-ID:
<69lotj$duj13@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,95eda6788eace4fd,start X-Google-Attributes: gid1089d0,public From: "Simon" <simonp@netlogic.com> Subject: java.awt.Graphics.drawArc Date: 1998/01/15 Message-ID: <69lotj$duj13@forums.borland.com> X-Deja-AN: 316284823 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Organization: None Newsgroups: borland.public.jbuilder.java.api