|
|
@ -654,23 +654,39 @@ class Camera1 extends CameraController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// -----------------
|
|
|
|
// -----------------
|
|
|
|
// Zoom stuff.
|
|
|
|
// Zoom and simpler stuff.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
boolean setZoom(float zoom) { |
|
|
|
boolean setZoom(float zoom) { |
|
|
|
if (!isCameraOpened()) return false; |
|
|
|
if (!isCameraOpened()) return false; |
|
|
|
|
|
|
|
if (!mOptions.isZoomSupported()) return false; |
|
|
|
synchronized (mLock) { |
|
|
|
synchronized (mLock) { |
|
|
|
Camera.Parameters params = mCamera.getParameters(); |
|
|
|
Camera.Parameters params = mCamera.getParameters(); |
|
|
|
if (!mOptions.isZoomSupported()) return false; |
|
|
|
|
|
|
|
float max = params.getMaxZoom(); |
|
|
|
float max = params.getMaxZoom(); |
|
|
|
params.setZoom((int) (zoom * max)); |
|
|
|
params.setZoom((int) (zoom * max)); |
|
|
|
mCamera.setParameters(params); |
|
|
|
mCamera.setParameters(params); |
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
boolean setExposureCorrection(float EVvalue) { |
|
|
|
|
|
|
|
if (!isCameraOpened()) return false; |
|
|
|
|
|
|
|
if (!mOptions.isExposureCorrectionSupported()) return false; |
|
|
|
|
|
|
|
float max = mOptions.getExposureCorrectionMaxValue(); |
|
|
|
|
|
|
|
float min = mOptions.getExposureCorrectionMinValue(); |
|
|
|
|
|
|
|
EVvalue = EVvalue < min ? min : EVvalue > max ? max : EVvalue; // cap
|
|
|
|
|
|
|
|
synchronized (mLock) { |
|
|
|
|
|
|
|
Camera.Parameters params = mCamera.getParameters(); |
|
|
|
|
|
|
|
int indexValue = (int) (EVvalue / params.getExposureCompensationStep()); |
|
|
|
|
|
|
|
params.setExposureCompensation(indexValue); |
|
|
|
|
|
|
|
mCamera.setParameters(params); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// -----------------
|
|
|
|
// -----------------
|
|
|
|
// Tap to focus stuff.
|
|
|
|
// Tap to focus stuff.
|
|
|
|
|
|
|
|
|
|
|
@ -681,10 +697,8 @@ class Camera1 extends CameraController { |
|
|
|
List<Camera.Area> meteringAreas2 = computeMeteringAreas(x, y); |
|
|
|
List<Camera.Area> meteringAreas2 = computeMeteringAreas(x, y); |
|
|
|
List<Camera.Area> meteringAreas1 = meteringAreas2.subList(0, 1); |
|
|
|
List<Camera.Area> meteringAreas1 = meteringAreas2.subList(0, 1); |
|
|
|
synchronized (mLock) { |
|
|
|
synchronized (mLock) { |
|
|
|
|
|
|
|
// At this point we are sure that camera supports auto focus... right? Look at CameraView.onTouchEvent().
|
|
|
|
Camera.Parameters params = mCamera.getParameters(); |
|
|
|
Camera.Parameters params = mCamera.getParameters(); |
|
|
|
// TODO remove this check once CameraView.setFocus TODO is fixed.
|
|
|
|
|
|
|
|
boolean autofocusSupported = mOptions.getSupportedFocus().contains(CameraConstants.FOCUS_TAP); |
|
|
|
|
|
|
|
if (autofocusSupported) { |
|
|
|
|
|
|
|
int maxAF = params.getMaxNumFocusAreas(); |
|
|
|
int maxAF = params.getMaxNumFocusAreas(); |
|
|
|
int maxAE = params.getMaxNumMeteringAreas(); |
|
|
|
int maxAE = params.getMaxNumMeteringAreas(); |
|
|
|
if (maxAF > 0) params.setFocusAreas(maxAF > 1 ? meteringAreas2 : meteringAreas1); |
|
|
|
if (maxAF > 0) params.setFocusAreas(maxAF > 1 ? meteringAreas2 : meteringAreas1); |
|
|
@ -701,7 +715,6 @@ class Camera1 extends CameraController { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void postResetFocus() { |
|
|
|
private void postResetFocus() { |
|
|
|