Java Affine Transformation

You can modify the transform attribute in the Graphics2D context to move, rotate, scale, and shear graphics primitives when they are rendered. The transform attribute is defined by an instance of the AffineTransform class. An affine transform is a transformation such as translate, rotate, scale, or shear in which parallel lines remain parallel even after being transformed.

The Graphics2D class provides several methods for changing the transform attribute.

Examples

  1. Tform.java shows some Math operations using AffineTransform
  2. Transform.java shows graphical operations using AffineTransform. This code was modified from the tutorial in the reference.

Download code from transform.zip

Referernce

Java Tutorial Transforming Shapes, Text, and Images


Maintained by John Loomis, last updated 30 January 2019