 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
PaulSchrum Guest
|
Posted: Sun Dec 24, 2006 8:10 am Post subject: Lineweight dependent on drawing scale - how to keep line wei |
|
|
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
|
Posted: Mon Dec 25, 2006 2:44 pm Post subject: Re: Lineweight dependent on drawing scale - how to keep line |
|
|
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
|
Posted: Wed Jan 03, 2007 4:45 am Post subject: Re: Lineweight dependent on drawing scale - how to keep line |
|
|
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
|
Posted: Thu Jan 04, 2007 4:14 am Post subject: Re: Lineweight dependent on drawing scale - how to keep line |
|
|
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 |
|
 |
|
|
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
|
|