Code example for Camera

Methods: getMatrix, restore, rotateY, save, translate

0
    private void drawFace(final Canvas canvas, final Bitmap view, final int top, final int left,
                          final int centerX, final int centerY, final float scale, final float rotation) {
 
        // create the camera if we haven't before 
        if (mCamera == null) {
            mCamera = new Camera();
        } 
 
        // save the camera state 
        mCamera.save();
 
        // translate and then rotate the camera 
        mCamera.translate(0, 0, centerX);
        mCamera.rotateY(rotation);
        mCamera.translate(0, 0, -centerX);
 
        // create the matrix if we haven't before 
        if (mMatrix == null) {
            mMatrix = new Matrix();
        } 
 
        // get the matrix from the camera and then restore the camera 
        mCamera.getMatrix(mMatrix);
        mCamera.restore();
 
        // translate and scale the matrix 
        mMatrix.preTranslate(-centerX, -centerY);
        mMatrix.postScale(scale, scale);
        mMatrix.postTranslate(left + centerX, top + centerY);