本文整理匯總了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);