本文整理汇总了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;
}
示例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);
}
}
}
示例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;
}
示例4: autoFocusAsync
import android.hardware.Camera; //导入方法依赖的package包/类
public static void autoFocusAsync(Camera.AutoFocusCallback autoFocusCallback)
{
getInstance().mCamera.autoFocus(autoFocusCallback);
}
示例5: autoFocus
import android.hardware.Camera; //导入方法依赖的package包/类
@Override
public void autoFocus(Camera.AutoFocusCallback cb) {
camera.autoFocus(cb);
}
示例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);