示例#1
0
 /**
  * Sets the up camera to be connected to GPUImage to get a filtered preview.
  *
  * @param camera the camera
  * @param degrees by how many degrees the image should be rotated
  * @param flipHorizontal if the image should be flipped horizontally
  * @param flipVertical if the image should be flipped vertically
  */
 public void setUpCamera(
     final Camera camera,
     final int degrees,
     final boolean flipHorizontal,
     final boolean flipVertical) {
   mGlSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
   if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) {
     setUpCameraGingerbread(camera);
   } else {
     camera.setPreviewCallback(mRenderer);
     camera.startPreview();
   }
   Rotation rotation = Rotation.NORMAL;
   switch (degrees) {
     case 90:
       rotation = Rotation.ROTATION_90;
       break;
     case 180:
       rotation = Rotation.ROTATION_180;
       break;
     case 270:
       rotation = Rotation.ROTATION_270;
       break;
   }
   mRenderer.setRotationCamera(rotation, flipHorizontal, flipVertical);
 }
示例#2
0
 /**
  * Sets the up camera to be connected to GPUImage to get a filtered preview.
  *
  * @param camera the camera
  * @param degrees by how many degrees the image should be rotated
  * @param flipHorizontal if the image should be flipped horizontally
  * @param flipVertical if the image should be flipped vertically
  */
 public void setUpCamera(
     final Camera camera,
     boolean userFront,
     final boolean flipHorizontal,
     final boolean flipVertical) {
   try {
     mGlSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
     Rotation rotation = Rotation.ROTATION_90;
     if (userFront) {
       rotation = Rotation.ROTATION_270;
     } else {
       rotation = Rotation.ROTATION_90;
     }
     mRenderer.setRotationCamera(rotation, flipHorizontal, flipVertical);
     if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) {
       setUpCameraGingerbread(camera);
     } else {
       camera.setPreviewCallback(mRenderer);
       camera.startPreview();
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }