Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.graphics.Matrix;

public class Main {
    /**
     * @return matrix with correct configuration for the front camera.
     * Function to set correct height orientation and rotation for saving the image
     * in sd card.
     */
    public static Matrix setOrientationForFrontCamera() {
        Matrix matrix = new Matrix();
        matrix.postRotate(-90);
        //for mirror images
        float[] mirrorY = { -1, 0, 0, 0, 1, 0, 0, 0, 1 };
        Matrix matrixMirrorY = new Matrix();
        matrixMirrorY.setValues(mirrorY);
        matrix.postConcat(matrixMirrorY);
        return matrix;
    }
}