2012-07-31 11 views
3

當您使用Graphics2D.scale();並繪製形狀時,輪廓厚度也會縮放。Java - 繪製線寬爲1的放大形狀

有沒有一種方法來繪製它,而沒有縮放線條的厚度?也許除了使用上述函數外,還有另一種有效的方法來擴展它?

回答

0

您將不得不將繪圖另存爲線矢量列表,並以各種尺寸縮放和繪製繪圖以保持所需的線條粗細。

0

我剛剛找到了解決我自己的問題。我不知道它是多麼有效,但它按預期工作:

Area area = new Area(myShape); //myShape is the shape I want to scale 
AffineTransform at = new AffineTransform(); 
at.scale(2,2); 
area = area.createTransformedArea(at); 
graphics2d.draw(area); //graphics2d is the Graphics2D instance to do the drawing 

也許有人能指教我這是否是採取一個好辦法?