Code example for Camera

Methods: getMatrixrestorerotateYsavetranslate

    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;
        // translate and then rotate the camera 
        mCamera.translate(0, 0, centerX);
        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 
        // translate and scale the matrix 
        mMatrix.preTranslate(-centerX, -centerY);
        mMatrix.postScale(scale, scale);
        mMatrix.postTranslate(left + centerX, top + centerY);