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

Java examples for 2D Graphics:Transform

Description

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

Demo Code


//package com.java2s;

import java.awt.geom.AffineTransform;

public class Main {


    /**/*from ww w.  ja  va2  s.c o m*/
     * This returns an affine transform which will flip the vertical
     * 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 y-axis. */
    public static AffineTransform getYFlipTransform(int height) {
        return new AffineTransform(1., 0., 0., -1., 0., (double) height);
    }
}

Related Tutorials