Code example for Matrix

Methods: createBitmap, preScale

0
 
		int width = originalImage.getWidth();
		int height = originalImage.getHeight();
 
		// This will not scale but will flip on the Y axis 
		Matrix matrix = new Matrix();
		matrix.preScale(1, -1);
 
		// Create a Bitmap with the flip matrix applied to it. 
		// We only want the bottom half of the image 
 
		Bitmap reflectionImage = Bitmap.createBitmap(originalImage, 0,
				(int) (height * .3), width, (int) (height * .3), matrix, false);
 
		// Create a new bitmap with same width but taller to fit reflection 
		Bitmap bitmapWithReflection = Bitmap.createBitmap(width,
				(height + (int) (height * .3)), Config.ARGB_8888);
 
		// Create a new Canvas with the bitmap that's big enough for 
		// the image plus gap plus reflection 
		Canvas canvas = new Canvas(bitmapWithReflection);