示例#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,
     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();
   }
 }