rotate Path - Android Graphics

Android examples for Graphics:Path

Description

rotate Path

Demo Code


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

public class Main {
    /**/*from w  w w .  j a  v a2s  .  c  o  m*/
     * @param x
     *            Position um die gefreht wird
     * @param y
     *            Position um die gefreht wird
     * @param path
     *            der pfad der gedreht werden soll
     * @param rotate
     *            gradzahl 0-360
     */
    public static void rotatePath(final float x, final float y,
            final Path path, final int rotate) {
        final Matrix mMatrix = new Matrix();
        final RectF bounds = new RectF();
        path.computeBounds(bounds, true);
        mMatrix.postRotate(rotate, x, y);
        path.transform(mMatrix);
    }
}

Related Tutorials