Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / January 2007

Tip: Looking for answers? Try searching our database.

Lineweight dependent on drawing scale - how to keep line weight at 1

Thread view: 
PaulSchrum - 24 Dec 2006 02:33 GMT
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
Daniel Pitts - 25 Dec 2006 08:44 GMT
> I am drawing Line2D and Quad2D elements on a JFrame using Graphics2D.
>
[quoted text clipped - 8 lines]
>
> - 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()
Judy Szikora - 02 Jan 2007 22:45 GMT
>>I am drawing Line2D and Quad2D elements on a JFrame using Graphics2D.
>>
[quoted text clipped - 18 lines]
>
> 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.

Signature

Judy Szikora, Apprisant Technologies Inc.
http://www.apprisant.com

PaulSchrum - 03 Jan 2007 22:14 GMT
> >>I am drawing Line2D and Quad2D elements on a JFrame using Graphics2D.
> >>
[quoted text clipped - 6 lines]
> java.awt.geom.AffineTransform.createTransformedShape(), and then draw it
> without scaling.

Judy,

Thanks.  I did not know about this method.  I will use that.

- Paul


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.