Code example for Matrix

Methods: createBitmap, preRotate

0
				options.inPreferredConfig = Bitmap.Config.RGB_565;
	        mBitmap = BitmapFactory.decodeFile(mPath, options);
        } 
         
        // Rotate to right direction 
        Matrix matrix = new Matrix();
		float rotation = rotationForImage(mPath);
		if (rotation != 0f) {
			matrix.preRotate(rotation);
		} 
 
		if(mBitmap != null) {
			int height = mBitmap.getHeight();
			int width = mBitmap.getWidth();
			mBitmap = Bitmap.createBitmap(mBitmap, 0, 0, width, height, matrix,
					true); 
		} 
	    return mBitmap;
	} 
	 
	public static int rotationForImage(String filename) {