当前位置: 首页>>代码示例>>Java>>正文


Java Parameters.getSupportedFocusModes方法代码示例

本文整理汇总了Java中android.hardware.Camera.Parameters.getSupportedFocusModes方法的典型用法代码示例。如果您正苦于以下问题:Java Parameters.getSupportedFocusModes方法的具体用法?Java Parameters.getSupportedFocusModes怎么用?Java Parameters.getSupportedFocusModes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.hardware.Camera.Parameters的用法示例。


在下文中一共展示了Parameters.getSupportedFocusModes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setFocusMode

import android.hardware.Camera.Parameters; //导入方法依赖的package包/类
@UiThread
private void setFocusMode(Parameters params) {
	List<String> focusModes = params.getSupportedFocusModes();
	if (LOG.isLoggable(INFO)) LOG.info("Focus modes: " + focusModes);
	if (focusModes.contains(FOCUS_MODE_CONTINUOUS_PICTURE)) {
		params.setFocusMode(FOCUS_MODE_CONTINUOUS_PICTURE);
	} else if (focusModes.contains(FOCUS_MODE_CONTINUOUS_VIDEO)) {
		params.setFocusMode(FOCUS_MODE_CONTINUOUS_VIDEO);
	} else if (focusModes.contains(FOCUS_MODE_EDOF)) {
		params.setFocusMode(FOCUS_MODE_EDOF);
	} else if (focusModes.contains(FOCUS_MODE_MACRO)) {
		params.setFocusMode(FOCUS_MODE_MACRO);
	} else if (focusModes.contains(FOCUS_MODE_AUTO)) {
		params.setFocusMode(FOCUS_MODE_AUTO);
	} else if (focusModes.contains(FOCUS_MODE_FIXED)) {
		params.setFocusMode(FOCUS_MODE_FIXED);
	}
}
 
开发者ID:rafjordao,项目名称:Nird2,代码行数:19,代码来源:CameraView.java

示例2: onCameraReady

import android.hardware.Camera.Parameters; //导入方法依赖的package包/类
@TargetApi(14)
private void onCameraReady(final @NonNull Camera camera) {
  final Parameters parameters = camera.getParameters();

  if (VERSION.SDK_INT >= 14) {
    parameters.setRecordingHint(true);
    final List<String> focusModes = parameters.getSupportedFocusModes();
    if (focusModes.contains(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE)) {
      parameters.setFocusMode(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
    } else if (focusModes.contains(Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) {
      parameters.setFocusMode(Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);
    }
  }

  displayOrientation = CameraUtils.getCameraDisplayOrientation(getActivity(), getCameraInfo());
  camera.setDisplayOrientation(displayOrientation);
  camera.setParameters(parameters);
  enqueueTask(new PostInitializationTask<Void>() {
    @Override
    protected Void onRunBackground() {
      try {
        camera.setPreviewDisplay(surface.getHolder());
        startPreview(parameters);
      } catch (Exception e) {
        Log.w(TAG, "couldn't set preview display", e);
      }
      return null;
    }
  });
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:31,代码来源:CameraView.java

示例3: setupCaptureParams

import android.hardware.Camera.Parameters; //导入方法依赖的package包/类
private void setupCaptureParams(Parameters parameters) {
    List<Size> supportedSizes = parameters.getSupportedPreviewSizes();
    if (!findBestPreviewSize(supportedSizes, true, true)) {
        Log.w(TAG, "No 4:3 ratio preview size supported.");
        if (!findBestPreviewSize(supportedSizes, false, true)) {
            Log.w(TAG, "Can't find a supported preview size smaller than 960x720.");
            findBestPreviewSize(supportedSizes, false, false);
        }
    }
    Log.d(TAG, "camera preview h = "
                + mCameraPreviewHeight + " , w = " + mCameraPreviewWidth);
    parameters.setPreviewSize(mCameraPreviewWidth, mCameraPreviewHeight);

    List<int[]> frameRates = parameters.getSupportedPreviewFpsRange();
    int last = frameRates.size() - 1;
    int minFps = (frameRates.get(last))[Parameters.PREVIEW_FPS_MIN_INDEX];
    int maxFps = (frameRates.get(last))[Parameters.PREVIEW_FPS_MAX_INDEX];
    parameters.setPreviewFpsRange(minFps, maxFps);
    Log.d(TAG, "preview fps: " + minFps + ", " + maxFps);

    List<String> supportedFocusModes = parameters.getSupportedFocusModes();
    if (supportedFocusModes.indexOf(mTargetFocusMode) >= 0) {
        parameters.setFocusMode(mTargetFocusMode);
    } else {
        // Use the default focus mode and log a message
        Log.w(TAG, "Cannot set the focus mode to " + mTargetFocusMode +
              " becuase the mode is not supported.");
    }

    parameters.set(CameraUtil.RECORDING_HINT, CameraUtil.FALSE);

    mHorizontalViewAngle = parameters.getHorizontalViewAngle();
    mVerticalViewAngle =  parameters.getVerticalViewAngle();
}
 
开发者ID:asm-products,项目名称:nexus-camera,代码行数:35,代码来源:WideAnglePanoramaModule.java

示例4: surfaceCreated

import android.hardware.Camera.Parameters; //导入方法依赖的package包/类
@Override
@TargetApi(14)
public void surfaceCreated(SurfaceHolder holder) {
    surfaceDestroyed(holder);

    try {
        // Open the camera
        mCamera = Camera.open(mCameraId);
        mCamera.setPreviewDisplay(holder);
        mCamera.setPreviewCallback(mScanAsyncTask);
    } catch (Exception e) {
        e.printStackTrace();
        surfaceDestroyed(holder);

        // Show error message
        findViewById(R.id.surfaceview).setVisibility(View.INVISIBLE);
        findViewById(R.id.progress).setVisibility(View.INVISIBLE);
        findViewById(R.id.window).setVisibility(View.INVISIBLE);
        findViewById(R.id.textview).setVisibility(View.VISIBLE);
        return;
    }

    // Set auto-focus mode
    Parameters params = mCamera.getParameters();
    List<String> modes = params.getSupportedFocusModes();
    if (modes.contains(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE))
        params.setFocusMode(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
    else if (modes.contains(Parameters.FOCUS_MODE_CONTINUOUS_VIDEO))
        params.setFocusMode(Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);
    else if (modes.contains(Parameters.FOCUS_MODE_AUTO)) {
        params.setFocusMode(Parameters.FOCUS_MODE_AUTO);
        mHandler = new AutoFocusHandler(mCamera);
    }
    mCamera.setParameters(params);
}
 
开发者ID:Dazzozo,项目名称:freeotp,代码行数:36,代码来源:ScanActivity.java


注:本文中的android.hardware.Camera.Parameters.getSupportedFocusModes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。