Scaling/Translating a Shape to a given Rectangle using AffineTransform

Note that AffineTransform transformations are concatenated “in the most commonly useful way”, which may be regarded as last in, first-out order. The effect can be seen in this example. Given the sequence below, the resulting Shape is first rotated, then scaled and finally translated.

at.translate(SIZE/2, SIZE/2);
at.scale(60, 60);
at.rotate(Math.PI/4);
return at.createTransformedShape(...);

Leave a Comment