AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Lineweight dependent on drawing scale - how to keep line wei

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java GUI Toolkits
View previous topic :: View next topic  
Author Message
PaulSchrum
Guest





PostPosted: Sun Dec 24, 2006 8:10 am    Post subject: Lineweight dependent on drawing scale - how to keep line wei Reply with quote



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
Back to top
Daniel Pitts
Guest





PostPosted: Mon Dec 25, 2006 2:44 pm    Post subject: Re: Lineweight dependent on drawing scale - how to keep line Reply with quote



PaulSchrum wrote:
Quote:
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()
Back to top
Judy Szikora
Guest





PostPosted: Wed Jan 03, 2007 4:45 am    Post subject: Re: Lineweight dependent on drawing scale - how to keep line Reply with quote



Daniel Pitts wrote:
Quote:
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
Back to top
PaulSchrum
Guest





PostPosted: Thu Jan 04, 2007 4:14 am    Post subject: Re: Lineweight dependent on drawing scale - how to keep line Reply with quote

Judy Szikora wrote:
Quote:
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?

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,

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

- Paul
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java GUI Toolkits All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.