Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Swing: Scale, translate  RSS feed

 
sdfsdf sdfsdfsdfsdf
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to revert this transformation:
g2.scale(scale, -scale);
g2.translate(-minLon, -(minLat + (float) bounds.getHeight()));
g2.setStroke(new BasicStroke(1.0f / scale)); // thin lines

I tried this, which did not work:
g2.scale(1/scale, -1/scale);
g2.translate(+minLon, +(minLat + (float) bounds.getHeight()));
g2.setStroke(new BasicStroke(1.0f * scale));

Help please!

 
Miklos Szeles
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Welcome to Javaranch. Please read the how to ask question FAQ. Please use real name, choose proper forum, and use code tags.
I haven't checked what your code exactly do, but what is obviously wrong, is the order of your calls. You have to call them in reverse order to revert the operation.
 
Campbell Ritchie
Sheriff
Posts: 53742
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Miklos Szeles wrote: . . . Please use real name, choose proper forum, and use code tags. . . .
Thank you for noticing.
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Swing. And yes, the name should be fixed. Thanks again Miklos.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!