Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #540

Re: Lineweight dependent

From "Judy Szikora" <judy.szikora@THRWHITE.remove-dii-this>
Subject Re: Lineweight dependent
Message-ID <AgBmh.548154$5R2.269315@pd7urf3no> (permalink)
Newsgroups comp.lang.java.gui
References <1167036255.427723.200880@i12g2000cwa.googlegroups.com>
Date 2011-04-27 15:28 +0000
Organization TDS.net

Show all headers | View raw


  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

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Lineweight dependent on d "PaulSchrum" <paulschrum@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
  Re: Lineweight dependent "Daniel Pitts" <daniel.pitts@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
    Re: Lineweight dependent "Judy Szikora" <judy.szikora@THRWHITE.remove-dii-this> - 2011-04-27 15:28 +0000
      Re: Lineweight dependent "PaulSchrum" <paulschrum@THRWHITE.remove-dii-this> - 2011-04-27 15:28 +0000

csiph-web