本文整理汇总了Java中com.google.zxing.client.android.camera.CameraConfigurationUtils类的典型用法代码示例。如果您正苦于以下问题:Java CameraConfigurationUtils类的具体用法?Java CameraConfigurationUtils怎么用?Java CameraConfigurationUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CameraConfigurationUtils类属于com.google.zxing.client.android.camera包,在下文中一共展示了CameraConfigurationUtils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setFlashEnabledInternal
import com.google.zxing.client.android.camera.CameraConfigurationUtils; //导入依赖的package包/类
private void setFlashEnabledInternal(boolean flashEnabled) {
try {
DecoderWrapper decoderWrapper = mDecoderWrapper;
Camera camera = decoderWrapper.getCamera();
Camera.Parameters parameters = camera.getParameters();
if (parameters == null) {
return;
}
boolean changed;
if (flashEnabled) {
changed = Utils.setFlashMode(parameters, Camera.Parameters.FLASH_MODE_TORCH);
} else {
changed = Utils.setFlashMode(parameters, Camera.Parameters.FLASH_MODE_OFF);
}
if (changed) {
CameraConfigurationUtils.setBestExposure(parameters, flashEnabled);
camera.setParameters(parameters);
}
} catch (Exception ignored) {
}
}
开发者ID:yuriy-budiyev,项目名称:code-scanner,代码行数:22,代码来源:CodeScanner.java
示例2: doSetTorch
import com.google.zxing.client.android.camera.CameraConfigurationUtils; //导入依赖的package包/类
private void doSetTorch(Camera.Parameters parameters, boolean newSetting, boolean safeMode) {
CameraConfigurationUtils.setTorch(parameters, newSetting);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
if (!safeMode && !prefs.getBoolean(PreferencesActivity.KEY_DISABLE_EXPOSURE, true)) {
CameraConfigurationUtils.setBestExposure(parameters, newSetting);
}
}
开发者ID:xiong-it,项目名称:ZXingAndroidExt,代码行数:8,代码来源:CameraConfigurationManager.java
示例3: initFromCameraParameters
import com.google.zxing.client.android.camera.CameraConfigurationUtils; //导入依赖的package包/类
/**
* Reads, one time, values from the camera that are needed by the app.
*/
void initFromCameraParameters(Camera camera) {
Camera.Parameters parameters = camera.getParameters();
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = manager.getDefaultDisplay();
Point theScreenResolution = new Point();
theScreenResolution = getDisplaySize(display);
screenResolution = theScreenResolution;
Log.i(TAG, "Screen resolution: " + screenResolution);
Point screenResolutionForCamera = new Point();
screenResolutionForCamera.x = screenResolution.x;
screenResolutionForCamera.y = screenResolution.y;
if (screenResolution.x < screenResolution.y) {
screenResolutionForCamera.x = screenResolution.y;
screenResolutionForCamera.y = screenResolution.x;
}
cameraResolution = CameraConfigurationUtils.findBestPreviewSizeValue(parameters, screenResolution);
Log.i(TAG, "Camera resolution x: " + cameraResolution.x);
Log.i(TAG, "Camera resolution y: " + cameraResolution.y);
}
开发者ID:snice,项目名称:androidscan,代码行数:27,代码来源:CameraConfigurationManager.java
示例4: measureCameraPreviewSize
import com.google.zxing.client.android.camera.CameraConfigurationUtils; //导入依赖的package包/类
/**
* 计算屏幕的尺寸
*
* @param camera
*/
private void measureCameraPreviewSize(Camera camera, int width, int height, int rotation) {
Camera.Parameters parameters = camera.getParameters();
previewFormat = parameters.getPreviewFormat();
previewFormatString = parameters.get("preview-format");
Log.d(TAG, "Default preview format: " + previewFormat + '/' + previewFormatString);
screenResolution = DeviceUtils.getScreenSize(mContext);
Log.d(TAG, "Screen resolution: " + screenResolution);
Point screenResolutionForCamera = new Point();
screenResolutionForCamera.x = width;
screenResolutionForCamera.y = height;
//根据view 的分辨率,计算出相机最适合的分辨率
cameraResolution = CameraConfigurationUtils.findBestPreviewSizeValue(parameters, screenResolutionForCamera);
Log.d(TAG, "Camera resolution: " + cameraResolution);
}
开发者ID:hnlbxb2004,项目名称:ZxingSupport,代码行数:25,代码来源:CameraConfig.java
示例5: openCamera
import com.google.zxing.client.android.camera.CameraConfigurationUtils; //导入依赖的package包/类
private Camera openCamera() {
Camera.CameraInfo info = new Camera.CameraInfo();
int id = chooseBackFacingCamera(info);
Camera camera = Camera.open(id);
Point screenResolution = new Point();
camera.setDisplayOrientation((info.orientation - getDisplayInfo(screenResolution) + 360) % 360);
Camera.Parameters parameters = camera.getParameters();
CameraConfigurationUtils.setFocus(parameters, true, true, false);
CameraConfigurationUtils.setBarcodeSceneMode(parameters);
CameraConfigurationUtils.setVideoStabilization(parameters);
CameraConfigurationUtils.setFocusArea(parameters);
CameraConfigurationUtils.setMetering(parameters);
mCaptureSize = CameraConfigurationUtils.findBestPreviewSizeValue(parameters, screenResolution);
Log.d(TAG, "Screen resolution: " + screenResolution.x + "x" + screenResolution.y);
Log.d(TAG, "Preview size: " + mCaptureSize.x + "x" + mCaptureSize.y);
parameters.setPreviewSize(mCaptureSize.x, mCaptureSize.y);
camera.setParameters(parameters);
return camera;
}
开发者ID:googlesamples,项目名称:attendee-checkin,代码行数:20,代码来源:ScannerManager.java
示例6: initFromCameraParameters
import com.google.zxing.client.android.camera.CameraConfigurationUtils; //导入依赖的package包/类
/**
* Reads, one time, values from the camera that are needed by the app.
*/
void initFromCameraParameters(Camera camera) {
Camera.Parameters parameters = camera.getParameters();
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = manager.getDefaultDisplay();
Point theScreenResolution = new Point();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
display.getSize(theScreenResolution);
} else {
theScreenResolution.set(display.getWidth(), display.getHeight());
}
screenResolution = theScreenResolution;
Log.i(TAG, "Screen resolution: " + screenResolution);
cameraResolution = CameraConfigurationUtils
.findBestPreviewSizeValue(parameters, screenResolution);
Log.i(TAG, "Camera resolution: " + cameraResolution);
}
开发者ID:mgouline,项目名称:droidxing,代码行数:20,代码来源:CameraConfigurationManager.java
示例7: setDesiredCameraParameters
import com.google.zxing.client.android.camera.CameraConfigurationUtils; //导入依赖的package包/类
void setDesiredCameraParameters(Camera camera, boolean safeMode) {
Camera.Parameters parameters = camera.getParameters();
if (parameters == null) {
Log.w(TAG, "Device error: no camera parameters are available. Proceeding without configuration.");
return;
}
initializeTorch(parameters, safeMode);
CameraConfigurationUtils.setFocus(
parameters,
true,
true,
safeMode);
if (!safeMode) {
CameraConfigurationUtils.setBarcodeSceneMode(parameters);
CameraConfigurationUtils.setVideoStabilization(parameters);
CameraConfigurationUtils.setFocusArea(parameters);
CameraConfigurationUtils.setMetering(parameters);
}
parameters.setPreviewSize(cameraResolution.x, cameraResolution.y);
Log.i(TAG, "Final camera parameters: " + parameters.flatten());
camera.setParameters(parameters);
Camera.Parameters afterParameters = camera.getParameters();
Camera.Size afterSize = afterParameters.getPreviewSize();
if (afterSize != null && (cameraResolution.x != afterSize.width || cameraResolution.y != afterSize.height)) {
Log.w(TAG, "Camera said it supported preview size " + cameraResolution.x + 'x' + cameraResolution.y +
", but after setting it, preview size is " + afterSize.width + 'x' + afterSize.height);
cameraResolution.x = afterSize.width;
cameraResolution.y = afterSize.height;
}
camera.setDisplayOrientation(90);
}
开发者ID:snice,项目名称:androidscan,代码行数:38,代码来源:CameraConfigurationManager.java
示例8: doSetTorch
import com.google.zxing.client.android.camera.CameraConfigurationUtils; //导入依赖的package包/类
private void doSetTorch(Camera.Parameters parameters, boolean newSetting, boolean safeMode) {
CameraConfigurationUtils.setTorch(parameters, newSetting);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
//if (!safeMode && !prefs.getBoolean(PreferencesActivity.KEY_DISABLE_EXPOSURE, true)) {
CameraConfigurationUtils.setBestExposure(parameters, newSetting);
//}
}
开发者ID:crisfg86,项目名称:Zxing-Custom,代码行数:8,代码来源:CameraConfigurationManager.java
示例9: initFromCameraParameters
import com.google.zxing.client.android.camera.CameraConfigurationUtils; //导入依赖的package包/类
/**
* Reads, one time, values from the camera that are needed by the app.
*/
void initFromCameraParameters(Camera camera) {
Camera.Parameters parameters = camera.getParameters();
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = manager.getDefaultDisplay();
Point theScreenResolution = new Point();
display.getSize(theScreenResolution);
screenResolution = theScreenResolution;
Log.i(TAG, "Screen resolution: " + screenResolution);
cameraResolution = CameraConfigurationUtils.findBestPreviewSizeValue(parameters, screenResolution);
Log.i(TAG, "Camera resolution: " + cameraResolution);
}
开发者ID:BottleRocketStudios,项目名称:Android-Barcode,代码行数:15,代码来源:CameraConfigurationManager.java
示例10: onResume
import com.google.zxing.client.android.camera.CameraConfigurationUtils; //导入依赖的package包/类
@Override
protected void onResume() {
super.onResume();
camera = Camera.open();
parameters = camera.getParameters();
DisplayMetrics metric = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metric);
if (metric.widthPixels < metric.heightPixels){
camera.setDisplayOrientation(90);
} else {
camera.setDisplayOrientation(0);
}
CameraConfigurationUtils.setBestPreviewFPS(parameters);
Log.d(null, "Display Metric:" + metric.widthPixels + "x" + metric.heightPixels);
Point p = CameraConfigurationUtils.findBestPreviewSizeValue(parameters, new Point(metric.widthPixels, metric.heightPixels));
setBestPreviewSize(p, metric, parameters);
List<String> focusMode = parameters.getSupportedFocusModes();
// 自动对焦优先
if (focusMode.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE)) {
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
} else if (focusMode.contains(Camera.Parameters.FOCUS_MODE_AUTO)) {
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
} else if (focusMode.contains(Camera.Parameters.FOCUS_MODE_MACRO)) {
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_MACRO);
} else {
isSupportAutoFocus = false;
}
if (isSupportAutoFocus) {
autoFocusCallback = new AutoFocusCallBack();
}
parameters.setPreviewFormat(ImageFormat.NV21);
camera.setParameters(parameters);
previewCallback = new PreviewCallBack();
camera.setPreviewCallback(previewCallback);
startPreview();
camera.startPreview();
}
开发者ID:muyuballs,项目名称:FxExplorer,代码行数:39,代码来源:ScannerActivity.java
示例11: doSetTorch
import com.google.zxing.client.android.camera.CameraConfigurationUtils; //导入依赖的package包/类
private void doSetTorch(Camera.Parameters parameters, boolean newSetting, boolean safeMode) {
CameraConfigurationUtils.setTorch(parameters, newSetting);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
if (!safeMode && !prefs.getBoolean(PreferencesActivity.KEY_DISABLE_EXPOSURE, true)) {
CameraConfigurationUtils.setBestExposure(parameters, newSetting);
}
}
开发者ID:srowen,项目名称:zxing-bsplus,代码行数:8,代码来源:CameraConfigurationManager.java
示例12: configureAdvanced
import com.google.zxing.client.android.camera.CameraConfigurationUtils; //导入依赖的package包/类
private static void configureAdvanced(Camera.Parameters parameters) {
CameraConfigurationUtils.setBestPreviewFPS(parameters);
CameraConfigurationUtils.setBarcodeSceneMode(parameters);
CameraConfigurationUtils.setVideoStabilization(parameters);
CameraConfigurationUtils.setMetering(parameters);
CameraConfigurationUtils.setZoom(parameters, ZOOM);
}
开发者ID:rlabancz,项目名称:casa-glass,代码行数:8,代码来源:CameraConfigurationManager.java
示例13: logAllParameters
import com.google.zxing.client.android.camera.CameraConfigurationUtils; //导入依赖的package包/类
public static void logAllParameters(Camera.Parameters parameters) {
if (Log.isLoggable(TAG, Log.INFO)) {
for (String line : CameraConfigurationUtils.collectStats(parameters).split("\n")) {
Log.i(TAG, line);
}
}
}
开发者ID:rlabancz,项目名称:casa-glass,代码行数:8,代码来源:CameraConfigurationManager.java
示例14: initialize
import com.google.zxing.client.android.camera.CameraConfigurationUtils; //导入依赖的package包/类
private void initialize() {
Camera camera = null;
Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
int cameraId = mCameraId;
if (cameraId == DEFAULT_CAMERA) {
int numberOfCameras = Camera.getNumberOfCameras();
for (int i = 0; i < numberOfCameras; i++) {
Camera.getCameraInfo(i, cameraInfo);
if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_BACK) {
camera = Camera.open(i);
mCameraId = i;
break;
}
}
} else {
camera = Camera.open(cameraId);
Camera.getCameraInfo(cameraId, cameraInfo);
}
if (camera == null) {
throw new CodeScannerException("Unable to access camera");
}
Camera.Parameters parameters = camera.getParameters();
if (parameters == null) {
throw new CodeScannerException("Unable to configure camera");
}
int orientation = Utils.getDisplayOrientation(mContext, cameraInfo);
boolean portrait = Utils.isPortrait(orientation);
Point imageSize =
Utils.findSuitableImageSize(parameters, portrait ? mHeight : mWidth, portrait ? mWidth : mHeight);
int imageWidth = imageSize.getX();
int imageHeight = imageSize.getY();
parameters.setPreviewSize(imageWidth, imageHeight);
Point previewSize =
Utils.getPreviewSize(portrait ? imageHeight : imageWidth, portrait ? imageWidth : imageHeight,
mWidth, mHeight);
List<String> focusModes = parameters.getSupportedFocusModes();
boolean autoFocusSupported = focusModes != null &&
(focusModes.contains(Camera.Parameters.FOCUS_MODE_AUTO) ||
focusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE));
if (!autoFocusSupported) {
mAutoFocusEnabled = false;
}
if (autoFocusSupported && mAutoFocusEnabled) {
Utils.setAutoFocusMode(parameters, mAutoFocusMode);
}
List<String> flashModes = parameters.getSupportedFlashModes();
boolean flashSupported = flashModes != null && flashModes.contains(Camera.Parameters.FLASH_MODE_TORCH);
if (!flashSupported) {
mFlashEnabled = false;
}
Utils.optimizeParameters(parameters);
CameraConfigurationUtils.setBestExposure(parameters, mFlashEnabled);
camera.setParameters(parameters);
camera.setDisplayOrientation(orientation);
mInitializeLock.lock();
try {
Decoder decoder = new Decoder(mDecoderStateListener, mFormats, mDecodeCallback);
mDecoderWrapper = new DecoderWrapper(camera, cameraInfo, decoder, imageSize, previewSize,
new Point(mWidth, mHeight), orientation, autoFocusSupported, flashSupported);
decoder.start();
mInitialization = false;
mInitialized = true;
} finally {
mInitializeLock.unlock();
}
mMainThreadHandler.post(new FinishInitializationTask(previewSize));
}
开发者ID:yuriy-budiyev,项目名称:code-scanner,代码行数:68,代码来源:CodeScanner.java
示例15: optimizeParameters
import com.google.zxing.client.android.camera.CameraConfigurationUtils; //导入依赖的package包/类
public static void optimizeParameters(@NonNull Camera.Parameters parameters) {
CameraConfigurationUtils.setBestPreviewFPS(parameters);
CameraConfigurationUtils.setBarcodeSceneMode(parameters);
CameraConfigurationUtils.setVideoStabilization(parameters);
parameters.setPreviewFormat(ImageFormat.NV21);
}
开发者ID:yuriy-budiyev,项目名称:code-scanner,代码行数:7,代码来源:Utils.java
示例16: doSetTorch
import com.google.zxing.client.android.camera.CameraConfigurationUtils; //导入依赖的package包/类
private void doSetTorch(Camera.Parameters parameters, boolean newSetting, boolean safeMode) {
CameraConfigurationUtils.setTorch(parameters, newSetting);
if (!safeMode && !Config.ConfigType.KEY_DISABLE_EXPOSURE.enable()) {
CameraConfigurationUtils.setBestExposure(parameters, newSetting);
}
}
开发者ID:10045125,项目名称:QrCode,代码行数:7,代码来源:CameraConfigurationManager.java
示例17: setDesiredCameraParameters
import com.google.zxing.client.android.camera.CameraConfigurationUtils; //导入依赖的package包/类
void setDesiredCameraParameters(OpenCamera camera, boolean safeMode) {
Camera theCamera = camera.getCamera();
Camera.Parameters parameters = theCamera.getParameters();
if (parameters == null) {
Log.w(TAG, "Device error: no camera parameters are available. Proceeding without configuration.");
return;
}
Log.i(TAG, "Initial camera parameters: " + parameters.flatten());
if (safeMode) {
Log.w(TAG, "In camera config safe mode -- most settings will not be honored");
}
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
initializeTorch(parameters, prefs, safeMode);
CameraConfigurationUtils.setFocus(
parameters,
prefs.getBoolean(PreferencesActivity.KEY_AUTO_FOCUS, true),
prefs.getBoolean(PreferencesActivity.KEY_DISABLE_CONTINUOUS_FOCUS, true),
safeMode);
if (!safeMode) {
if (prefs.getBoolean(PreferencesActivity.KEY_INVERT_SCAN, false)) {
CameraConfigurationUtils.setInvertColor(parameters);
}
if (!prefs.getBoolean(PreferencesActivity.KEY_DISABLE_BARCODE_SCENE_MODE, true)) {
CameraConfigurationUtils.setBarcodeSceneMode(parameters);
}
if (!prefs.getBoolean(PreferencesActivity.KEY_DISABLE_METERING, true)) {
CameraConfigurationUtils.setVideoStabilization(parameters);
CameraConfigurationUtils.setFocusArea(parameters);
CameraConfigurationUtils.setMetering(parameters);
}
}
parameters.setPreviewSize(bestPreviewSize.x, bestPreviewSize.y);
theCamera.setParameters(parameters);
theCamera.setDisplayOrientation(cwRotationFromDisplayToCamera);
Camera.Parameters afterParameters = theCamera.getParameters();
Camera.Size afterSize = afterParameters.getPreviewSize();
if (afterSize != null && (bestPreviewSize.x != afterSize.width || bestPreviewSize.y != afterSize.height)) {
Log.w(TAG, "Camera said it supported preview size " + bestPreviewSize.x + 'x' + bestPreviewSize.y +
", but after setting it, preview size is " + afterSize.width + 'x' + afterSize.height);
bestPreviewSize.x = afterSize.width;
bestPreviewSize.y = afterSize.height;
}
}
开发者ID:xiong-it,项目名称:ZXingAndroidExt,代码行数:59,代码来源:CameraConfigurationManager.java
示例18: doSetTorch
import com.google.zxing.client.android.camera.CameraConfigurationUtils; //导入依赖的package包/类
private void doSetTorch(Camera.Parameters parameters, boolean newSetting, boolean safeMode) {
CameraConfigurationUtils.setTorch(parameters, newSetting);
if (!safeMode) {
CameraConfigurationUtils.setBestExposure(parameters, newSetting);
}
}
开发者ID:snice,项目名称:androidscan,代码行数:7,代码来源:CameraConfigurationManager.java
示例19: setDesiredCameraParameters
import com.google.zxing.client.android.camera.CameraConfigurationUtils; //导入依赖的package包/类
void setDesiredCameraParameters(Camera camera, boolean safeMode) {
Camera.Parameters parameters = camera.getParameters();
if (parameters == null) {
Log.w(TAG, "Device error: no camera parameters are available. Proceeding without configuration.");
return;
}
Log.i(TAG, "Initial camera parameters: " + parameters.flatten());
if (safeMode) {
Log.w(TAG, "In camera config safe mode -- most settings will not be honored");
}
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
initializeTorch(parameters, prefs, safeMode);
CameraConfigurationUtils.setFocus(
parameters,
true,
true,
safeMode);
if (!safeMode) {
//if (prefs.getBoolean(PreferencesActivity.KEY_INVERT_SCAN, false)) {
// CameraConfigurationUtils.setInvertColor(parameters);
//}
//if (!prefs.getBoolean(PreferencesActivity.KEY_DISABLE_BARCODE_SCENE_MODE, true)) {
// CameraConfigurationUtils.setBarcodeSceneMode(parameters);
//}
//if (!prefs.getBoolean(PreferencesActivity.KEY_DISABLE_METERING, true)) {
// CameraConfigurationUtils.setVideoStabilization(parameters);
// CameraConfigurationUtils.setFocusArea(parameters);
// CameraConfigurationUtils.setMetering(parameters);
//}
}
parameters.setPreviewSize(cameraResolution.x, cameraResolution.y);
Log.i(TAG, "Final camera parameters: " + parameters.flatten());
camera.setParameters(parameters);
Camera.Parameters afterParameters = camera.getParameters();
Camera.Size afterSize = afterParameters.getPreviewSize();
if (afterSize!= null && (cameraResolution.x != afterSize.width || cameraResolution.y != afterSize.height)) {
Log.w(TAG, "Camera said it supported preview size " + cameraResolution.x + 'x' + cameraResolution.y +
", but after setting it, preview size is " + afterSize.width + 'x' + afterSize.height);
cameraResolution.x = afterSize.width;
cameraResolution.y = afterSize.height;
}
}
开发者ID:crisfg86,项目名称:Zxing-Custom,代码行数:57,代码来源:CameraConfigurationManager.java
示例20: setDesiredCameraParameters
import com.google.zxing.client.android.camera.CameraConfigurationUtils; //导入依赖的package包/类
void setDesiredCameraParameters(Camera camera, boolean safeMode) {
Camera.Parameters parameters = camera.getParameters();
if (parameters == null) {
Log.w(TAG, "Device error: no camera parameters are available. Proceeding without configuration.");
return;
}
Log.i(TAG, "Initial camera parameters: " + parameters.flatten());
if (safeMode) {
Log.w(TAG, "In camera config safe mode -- most settings will not be honored");
}
initializeTorch(parameters, safeMode);
CameraConfigurationUtils.setFocus(
parameters,
mZXingConfiguration.getBoolean(ZXingConfiguration.KEY_AUTO_FOCUS, true),
mZXingConfiguration.getBoolean(ZXingConfiguration.KEY_DISABLE_CONTINUOUS_FOCUS, true),
safeMode);
if (!safeMode) {
if (mZXingConfiguration.getBoolean(ZXingConfiguration.KEY_INVERT_SCAN, false)) {
CameraConfigurationUtils.setInvertColor(parameters);
}
if (!mZXingConfiguration.getBoolean(ZXingConfiguration.KEY_DISABLE_BARCODE_SCENE_MODE, true)) {
CameraConfigurationUtils.setBarcodeSceneMode(parameters);
}
if (!mZXingConfiguration.getBoolean(ZXingConfiguration.KEY_DISABLE_METERING, true)) {
CameraConfigurationUtils.setVideoStabilization(parameters);
CameraConfigurationUtils.setFocusArea(parameters);
CameraConfigurationUtils.setMetering(parameters);
}
}
parameters.setPreviewSize(cameraResolution.x, cameraResolution.y);
Log.i(TAG, "Final camera parameters: " + parameters.flatten());
camera.setParameters(parameters);
Camera.Parameters afterParameters = camera.getParameters();
Camera.Size afterSize = afterParameters.getPreviewSize();
if (afterSize != null && (cameraResolution.x != afterSize.width || cameraResolution.y != afterSize.height)) {
Log.w(TAG, "Camera said it supported preview size " + cameraResolution.x + 'x' + cameraResolution.y +
", but after setting it, preview size is " + afterSize.width + 'x' + afterSize.height);
cameraResolution.x = afterSize.width;
cameraResolution.y = afterSize.height;
}
}
开发者ID:BottleRocketStudios,项目名称:Android-Barcode,代码行数:55,代码来源:CameraConfigurationManager.java
注:本文中的com.google.zxing.client.android.camera.CameraConfigurationUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论