Java tutorial
//package com.java2s; import android.graphics.Matrix; public class Main { public static void prepareMatrix(Matrix matrix, boolean mirror, int displayOrientation, int viewWidth, int viewHeight) { matrix.setScale((float) (mirror ? -1 : 1), 1.0F); matrix.postRotate((float) displayOrientation); matrix.postScale((float) viewWidth / 2000.0F, (float) viewHeight / 2000.0F); matrix.postTranslate((float) viewWidth / 2.0F, (float) viewHeight / 2.0F); } }