mirror Path Left Right - Android Graphics

Android examples for Graphics:Path

Description

mirror Path Left Right

Demo Code


//package com.java2s;
import android.graphics.Matrix;
import android.graphics.Path;
import android.graphics.RectF;

public class Main {
    /**// w  w  w.  jav  a  2s.  com
     * Spiegel an der vertikalen y-Achse
     * 
     * @param x
     *            Position um die gefreht wird
     * @param y
     *            Position um die gefreht wird
     * @param path
     *            der pfad der gemirrored werden soll
     */
    public static void mirrorPathLeftRight(final float x, final float y,
            final Path path) {
        final Matrix mMatrix = new Matrix();
        final RectF bounds = new RectF();
        path.computeBounds(bounds, true);
        mMatrix.postScale(-1f, 1f, x, y);
        path.transform(mMatrix);
    }
}

Related Tutorials