Code example for Matrix

Methods: createBitmappreScale

		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 
Experience pair programming with AI  Get Codota for Java