android.hardware.Camera.startSmoothZoom()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(225)

本文整理了Java中android.hardware.Camera.startSmoothZoom()方法的一些代码示例,展示了Camera.startSmoothZoom()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Camera.startSmoothZoom()方法的具体详情如下:
包路径:android.hardware.Camera
类名称:Camera
方法名:startSmoothZoom

Camera.startSmoothZoom介绍

暂无

代码示例

代码示例来源:origin: zxfnicholas/CameraSDK

private void addZoomIn(int delta) {
  try {
    Camera.Parameters params = cameraInst.getParameters();
    Log.d("Camera", "Is support Zoom " + params.isZoomSupported());
    if (!params.isZoomSupported()) {
      return;
    }
    curZoomValue += delta;
    if (curZoomValue < 0) {
      curZoomValue = 0;
    } else if (curZoomValue > params.getMaxZoom()) {
      curZoomValue = params.getMaxZoom();
    }
    if (!params.isSmoothZoomSupported()) {
      params.setZoom(curZoomValue);
      cameraInst.setParameters(params);
      return;
    } else {
      cameraInst.startSmoothZoom(curZoomValue);
    }
  } catch (Exception e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: Yuphee/RecordVideo

/**
 * 放大预览视图
 */
private void zoomPreview() {
  Camera.Parameters parameters = mCamera.getParameters();
  int currentZoom = parameters.getZoom();
  int maxZoom = (int) (parameters.getMaxZoom() / 2f + 0.5);
  int destZoom = 0 == currentZoom ? maxZoom : 0;
  if (parameters.isSmoothZoomSupported()) {
    mCamera.stopSmoothZoom();
    mCamera.startSmoothZoom(destZoom);
  } else {
    Handler handler = getHandler();
    if (null == handler)
      return;
    handler.removeCallbacks(mZoomRunnable);
    handler.post(mZoomRunnable = new ZoomRunnable(destZoom, currentZoom, mCamera));
  }
}

代码示例来源:origin: ysq1051838264/CustomCamera

private void addZoomIn(int delta) {
  try {
    Camera.Parameters params = mCamera.getParameters();
    Log.d("Camera", "Is support Zoom " + params.isZoomSupported());
    if (!params.isZoomSupported()) {
      return;
    }
    curZoomValue += delta;
    if (curZoomValue < 0) {
      curZoomValue = 0;
    } else if (curZoomValue > params.getMaxZoom()) {
      curZoomValue = params.getMaxZoom();
    }
    if (!params.isSmoothZoomSupported()) {
      params.setZoom(curZoomValue);
      mCamera.setParameters(params);
      return;
    } else {
      mCamera.startSmoothZoom(curZoomValue);
    }
  } catch (Exception e) {
    e.printStackTrace();
  }
}

相关文章