Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.alt.net!news-in-01.newsfeed.easynews.com!easynews.com!easynews!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail From: "Judy Szikora" Subject: Re: Lineweight dependent Message-ID: X-Comment-To: comp.lang.java.gui Newsgroups: comp.lang.java.gui In-Reply-To: <1167036255.427723.200880@i12g2000cwa.googlegroups.com> References: <1167036255.427723.200880@i12g2000cwa.googlegroups.com> Content-Type: text/plain; charset=IBM437 Content-Transfer-Encoding: 8bit X-Gateway: time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92] Lines: 41 Date: Wed, 27 Apr 2011 15:28:08 GMT NNTP-Posting-Host: 96.60.20.240 X-Complaints-To: news@tds.net X-Trace: newsreading01.news.tds.net 1303918088 96.60.20.240 (Wed, 27 Apr 2011 10:28:08 CDT) NNTP-Posting-Date: Wed, 27 Apr 2011 10:28:08 CDT Organization: TDS.net Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.gui:540 To: comp.lang.java.gui Daniel Pitts wrote: > PaulSchrum wrote: > >>I am drawing Line2D and Quad2D elements on a JFrame using Graphics2D. >> >>When I increase the scale of the Graphics2D transform, the line weight >>increases, and I would rather this not happen. Is there a way I can >>suppress this? >> >>While I am on the subject, is there a way to manage lineweights in >>Graphics2D at all or independently of scale? >> >>Thanks. >> >>- Paul Schrum > > > If you set the stroke to have 0 width, it will draw the smallest > possible line on the output device. That may not be what you want, > however. > > The alternative is to adjust the width of the stroke based on the scale > factor, but that doesn't work well if you have vastly different scales > for x and y. > > look up Graphics2D.setStroke() > Instead of applying the scaling transformation to the Graphics2D, you can transform the shape with it first using java.awt.geom.AffineTransform.createTransformedShape(), and then draw it without scaling. -- Judy Szikora, Apprisant Technologies Inc. http://www.apprisant.com --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24