Code example for Camera

Methods: getMatrix, restore, rotateY, save, translate

0
   * @param imageView ImageView the ImageView whose bitmap we want to rotate 
   * @param t transformation 
   * @param rotationAngle the Angle by which to rotate the Bitmap 
   */ 
  private void transformImageBitmap(final View child, final Transformation t, final int rotationAngle) {
    mCamera.save();
    final Matrix imageMatrix = t.getMatrix();
    final int imageHeight = child.getWidth();
    final int imageWidth = child.getHeight();
    final int rotation = Math.min(Math.abs(rotationAngle), mMaxRotationAngle);
 
    //As the angle of the view gets less, zoom in 
    mCamera.translate(0.0f, 0.0f, rotation * zoomFactor);
 
    mCamera.rotateY(rotationAngle);
    mCamera.getMatrix(imageMatrix);
    imageMatrix.preTranslate(-(imageWidth / 2), -(imageHeight / 2));
    imageMatrix.postTranslate((imageWidth / 2), (imageHeight / 2));
    mCamera.restore();
  } 
 
}