Android Open Source - OpenGLAndroid-Camera Camera 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;
/* w w  w .  java  2s .c o m*/
import java.util.List;

import android.content.Context;
import android.content.pm.PackageManager;
import android.hardware.Camera;
import android.hardware.Camera.Parameters;

public class CameraHelpers {
  /** Check if this device has a camera */
  public static boolean hasCamera(Context context) {
      if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)){
          // this device has a camera
          return true;
      } else {
          // no camera on this device
          return false;
      }
  }

  public static boolean cameraHasColorEffect(Camera c, String colorEffect) {
    List<String> listOfColorEffects = c.getParameters().getSupportedColorEffects();
    if(listOfColorEffects.indexOf(colorEffect) != -1)
    {
      return true;
    }
    return false;
  }

  
  public static String cameraParamsToString(Parameters p) {
    String toRet = "ColorEffects: " + getConcatenatedList(p.getSupportedColorEffects());
    toRet = toRet + "  SupportedFocusModes: " + getConcatenatedList(p.getSupportedFocusModes());
    toRet = toRet + "  SupportedFlashModes: " + getConcatenatedList(p.getSupportedFlashModes());    
    return toRet;
  }

  private static String getConcatenatedList(List<String> list) {
    String toRet = "";
    for (String entry : list) {
        toRet = toRet + " " + entry;        
    }
    return toRet;
  }
  
  
  
}




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