Android Open Source - OpenGLAndroid-Camera Image Helpers






From Project

Back to project page OpenGLAndroid-Camera.

License

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.

Java Source Code

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);
  }

}




Java Source Code List

com.andrewtremblay.openglandroidcamera.CamGLSurfaceView.java
com.andrewtremblay.openglandroidcamera.CamRenderer.java
com.andrewtremblay.openglandroidcamera.CameraFilterActivity.java
com.andrewtremblay.openglandroidcamera.CameraPreview.java
com.andrewtremblay.openglandroidcamera.MyOpenGLShaders.java
com.andrewtremblay.openglandroidcamera.helpers.CameraHelpers.java
com.andrewtremblay.openglandroidcamera.helpers.DebugHelpers.java
com.andrewtremblay.openglandroidcamera.helpers.ImageHelpers.java
com.andrewtremblay.openglandroidcamera.helpers.MediaStorageHelpers.java
com.bigflake.androidmediacodecstuff.ExtractMpegFramesTest.java