prepare Jpg Matrix - Android Graphics

Android examples for Graphics:JPEG Image

Description

prepare Jpg Matrix

Demo Code


//package com.java2s;

import android.graphics.Matrix;

public class Main {
    public static void prepareJpgMatrix(Matrix matrix, boolean mirror,
            int displayOrientation, int viewWidth, int viewHeight) {
        // Need mirror for front camera.
        matrix.setScale(mirror ? -1 : 1, 1);
        // This is the value for android.hardware.Camera.setDisplayOrientation.
        matrix.postRotate(displayOrientation);
        matrix.postTranslate(viewWidth / 2f, viewHeight / 2f);
    }//  w  ww  .j  av a2  s . c om
}

Related Tutorials