View RSS Feed

Java AWT

Transforming Shapes, Text, and Images

Rate this Entry
by , 03-04-2012 at 04:48 PM (793 Views)
One can do the modification of the graphic attributes so that for performing these graphic primitives in graphic 2D context.
  • Move
  • Scale
  • Rotate
  • Shear


Transform attribute is defined by the instance of class AffineTransform. Parallel lines are found to be parallel no matter if the transformation has been done in affine transformation.

Graphics 2D class provides number of methods to change the transform attribute. Graphic2Dtransform can be changed by calling transform, at new AffineTransform.

For construction of new transforms, these factory methods are used.
  • getRotateInstance
  • getShearInstance
  • getScaleInstance
  • getTranslateInstance


For transformation, these methods are used:
  • rotate —Angle of rotation is specified, in radian.
  • scale —scaling factor is specified in the x & y direction
  • shear —shearing facto is specified in the x & y direction
  • translate —translation offset is specified in the x & y direction

Submit "Transforming Shapes, Text, and Images" to Facebook Submit "Transforming Shapes, Text, and Images" to Digg Submit "Transforming Shapes, Text, and Images" to del.icio.us Submit "Transforming Shapes, Text, and Images" to StumbleUpon Submit "Transforming Shapes, Text, and Images" to Google

Tags: images, shapes, text Add / Edit Tags
Categories
Graphics

Comments