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


Java CameraConfigurationUtils.setInvertColor方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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.setBestPreviewFPS(parameters);

    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:srowen,项目名称:zxing-bsplus,代码行数:61,代码来源:CameraConfigurationManager.java

示例4: setDesiredCameraParameters

import com.google.zxing.client.android.camera.CameraConfigurationUtils; //导入方法依赖的package包/类
void setDesiredCameraParameters(Camera camera, boolean safeMode) {
    Camera.Parameters parameters = camera.getParameters();
    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,
            CapturePreferences.getBoolean(CapturePreferences.KEY_AUTO_FOCUS),
            CapturePreferences.getBoolean(CapturePreferences.KEY_DISABLE_CONTINUOUS_FOCUS),
            safeMode);

    if (!safeMode) {
        if (CapturePreferences.getBoolean(CapturePreferences.KEY_INVERT_SCAN)) {
            CameraConfigurationUtils.setInvertColor(parameters);
        }

        if (!CapturePreferences.getBoolean(CapturePreferences.KEY_DISABLE_BARCODE_SCENE_MODE)) {
            CameraConfigurationUtils.setBarcodeSceneMode(parameters);
        }

        if (!CapturePreferences.getBoolean(CapturePreferences.KEY_DISABLE_METERING)) {
            CameraConfigurationUtils.setVideoStabilization(parameters);
            CameraConfigurationUtils.setFocusArea(parameters);
            CameraConfigurationUtils.setMetering(parameters);
        }

    }

    parameters.setPreviewSize(cameraResolution.x, cameraResolution.y);
    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:mgouline,项目名称:droidxing,代码行数:48,代码来源:CameraConfigurationManager.java


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