title: Rotation and Scaling -- How to do both and get the right result?
body: <p>I've got a set of Java2D calls that draw vectors on a graphics context.  I'd like for the image to be doubled in size and then rotated 90 degrees.</p>
  
  <p>I'm using the following code to do this:</p>
  
  <pre><code>Graphics2D g2 = // ... get graphics 2d somehow ...
  AffineTransform oldTransform = g2.getTransform();
  AffineTransform newTransform = (AffineTransform)oldTransform.clone();
  newTransform.concatenate(AffineTransform.getTranslateInstance(x1, x2));
  newTransform.concatenate(AffineTransform.getScaleInstance((double)newW/(double)iconW, (double)newH/(double)iconH));
  newTransform.concatenate(AffineTransform.getRotateInstance(Math.toRadians(rotationAngle), (double)iconW/2.0d, (double)iconH/2.0d));
  // ... do my drawing ...
  </code></pre>
  
  <p>This rotates and scales, however, the scale isn't applied the way I would like.  It is as if it is rotated before scaling, thus making the image wider on the wrong axis.</p>
  
  <p>Is there a better way to do this?</p>