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


Java Camera.AutoFocusCallback方法代码示例

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


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

示例1: startAutoFocus

import android.hardware.Camera; //导入方法依赖的package包/类
public boolean startAutoFocus(Camera.AutoFocusCallback autoFocusCallback) {
    if ((mIsSupportAutoFocus || mIsSupportAutoFocusContinuousPicture) && mCamera != null) {
        try {

            String focusMode = getCameraParameters().getFocusMode();

            if (!TextUtils.isEmpty(focusMode) && focusMode.
                    equals(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE)) {  // 如果是连续自动对焦, 来一次对焦处理
                mCamera.autoFocus(autoFocusCallback);
            } else {
                return false;
            }
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
        return true;
    }

    return false;
}
 
开发者ID:hoanganhtuan95ptit,项目名称:EditPhoto,代码行数:22,代码来源:CameraController.java

示例2: setFocusArea

import android.hardware.Camera; //导入方法依赖的package包/类
public void setFocusArea(final int pointX, final int pointY, final Camera.AutoFocusCallback callback) {
  if (mCamera != null) {

    mCamera.cancelAutoFocus();

    Camera.Parameters parameters = mCamera.getParameters();

    Rect focusRect = calculateTapArea(pointX, pointY, 1f);
    parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
    parameters.setFocusAreas(Arrays.asList(new Camera.Area(focusRect, 1000)));

    if (parameters.getMaxNumMeteringAreas() > 0) {
      Rect meteringRect = calculateTapArea(pointX, pointY, 1.5f);
      parameters.setMeteringAreas(Arrays.asList(new Camera.Area(meteringRect, 1000)));
    }

    try {
      setCameraParameters(parameters);
      mCamera.autoFocus(callback);
    } catch (Exception e) {
      Log.d(TAG, e.getMessage());
      callback.onAutoFocus(false, this.mCamera);
    }
  }
}
 
开发者ID:MrShakes,项目名称:cameraPreviewStream,代码行数:26,代码来源:CameraActivity.java

示例3: focus

import android.hardware.Camera; //导入方法依赖的package包/类
/**
 * 自动对焦
 */
private boolean focus(Camera.AutoFocusCallback callback) {
    try {
        camera.autoFocus(callback);
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
    return true;
}
 
开发者ID:AndroidEngineerChenXiaoshuang,项目名称:CSVideo,代码行数:13,代码来源:CsVideo.java

示例4: autoFocusAsync

import android.hardware.Camera; //导入方法依赖的package包/类
public static void autoFocusAsync(Camera.AutoFocusCallback autoFocusCallback)
{
    getInstance().mCamera.autoFocus(autoFocusCallback);
}
 
开发者ID:ravindu1024,项目名称:android-imaging-utils,代码行数:5,代码来源:CameraController.java

示例5: autoFocus

import android.hardware.Camera; //导入方法依赖的package包/类
@Override
public void autoFocus(Camera.AutoFocusCallback cb) {
    camera.autoFocus(cb);
}
 
开发者ID:PacktPublishing,项目名称:Expert-Android-Programming,代码行数:5,代码来源:DefaultEasyCamera.java

示例6: autoFocus

import android.hardware.Camera; //导入方法依赖的package包/类
/**
* See <a href="http://developer.android.com/reference/android/hardware/Camera.html#autoFocus%28android.hardware.Camera.AutoFocusCallback%29">Camera.autoFocus(..)</a>
*/
  void autoFocus(Camera.AutoFocusCallback cb);
 
开发者ID:PacktPublishing,项目名称:Expert-Android-Programming,代码行数:5,代码来源:EasyCamera.java


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