Reputation: 901
When you use Graphics2D.scale();
and draw a shape, the outline thickness is also scaled.
Is there a way to draw it without the line thickness being scaled? Perhaps there's another efficient way to scale it other than using the above function?
Upvotes: 4
Views: 1718
Reputation: 901
I've just found a solution to my own question. I've no idea how efficient it is but it works as intended:
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
Perhaps someone could enlighten me as to whether or not this is a good approach to take?
Upvotes: 0
Reputation: 51515
You're going to have to save your drawing as a list of line vectors, and scale and render the drawing at various sizes to maintain the line thickness you want.
Upvotes: 0
Reputation: 1658
This question is similar. It looks like you have to mess around with a Stroke object to set the right line width.
Upvotes: 1