Back to project page OpenGLAndroid-Camera.
The source code is released under:
Apache License
If you think the Android project OpenGLAndroid-Camera listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.andrewtremblay.openglandroidcamera.helpers; //from www .j a va 2 s. c o m import android.graphics.Bitmap; import android.graphics.Matrix; public class ImageHelpers { public enum Direction { VERTICAL, HORIZONTAL }; /** Creates a new bitmap by flipping the specified bitmap vertically or horizontally. @param src Bitmap to flip @param type Flip direction (horizontal or vertical) @return New bitmap created by flipping the given one vertically or horizontally as specified by the <code>type</code> parameter or the original bitmap if an unknown type is specified. **/ public static Bitmap flip(Bitmap src, Direction type) { Matrix matrix = new Matrix(); if(type == Direction.VERTICAL) { matrix.preScale(1.0f, -1.0f); } else if(type == Direction.HORIZONTAL) { matrix.preScale(-1.0f, 1.0f); } else { return src; } return Bitmap.createBitmap(src, 0, 0, src.getWidth(), src.getHeight(), matrix, true); } }