This returns an affine transform which will flip the horizontal axis around. - Java 2D Graphics

Java examples for 2D Graphics:Transform

Description

This returns an affine transform which will flip the horizontal axis around.

Demo Code


//package com.java2s;

import java.awt.geom.AffineTransform;

public class Main {


    /**/*from  w w w  . j av a  2s .c o  m*/
     * This returns an affine transform which will flip the horizontal
     * axis around.  (NOTE: that this transform should be
     * pre-concatenated with the existing one!)  The returned
     * transform will maintain the centerpoint of the window and flip
     * the direction of the x-axis. */
    public static AffineTransform getXFlipTransform(int width) {
        return new AffineTransform(-1., 0., 0., 1., (double) width, 0.);
    }
}

Related Tutorials