當前位置: 首頁>>代碼示例>>Java>>正文


Java Parameters.WHITE_BALANCE_AUTO屬性代碼示例

本文整理匯總了Java中android.hardware.Camera.Parameters.WHITE_BALANCE_AUTO屬性的典型用法代碼示例。如果您正苦於以下問題:Java Parameters.WHITE_BALANCE_AUTO屬性的具體用法?Java Parameters.WHITE_BALANCE_AUTO怎麽用?Java Parameters.WHITE_BALANCE_AUTO使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.hardware.Camera.Parameters的用法示例。


在下文中一共展示了Parameters.WHITE_BALANCE_AUTO屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setCameraParameters

@SuppressWarnings("deprecation")
private void setCameraParameters() {
    mParameters.setPreviewSize(mDesiredPreviewWidth, mDesiredPreviewHeight);
    int[] fpsRange = CameraUtil.getMaxPreviewFpsRange(mParameters);
    if (fpsRange.length > 0) {
        mParameters.setPreviewFpsRange(
                fpsRange[Parameters.PREVIEW_FPS_MIN_INDEX],
                fpsRange[Parameters.PREVIEW_FPS_MAX_INDEX]);
    } else {
        mParameters.setPreviewFrameRate(mProfile.videoFrameRate);
    }

    forceFlashOffIfSupported(!mUI.isVisible());

    // Set white balance parameter.
    String whiteBalance = mPreferences.getString(
            CameraSettings.KEY_WHITE_BALANCE,
            mActivity.getString(R.string.pref_camera_whitebalance_default));
    if (isSupported(whiteBalance,
            mParameters.getSupportedWhiteBalance())) {
        mParameters.setWhiteBalance(whiteBalance);
    } else {
        whiteBalance = mParameters.getWhiteBalance();
        if (whiteBalance == null) {
            whiteBalance = Parameters.WHITE_BALANCE_AUTO;
        }
    }

    // Set zoom.
    if (mParameters.isZoomSupported()) {
        mParameters.setZoom(mZoomValue);
    }

    // Set continuous autofocus.
    List<String> supportedFocus = mParameters.getSupportedFocusModes();
    if (isSupported(Parameters.FOCUS_MODE_CONTINUOUS_VIDEO, supportedFocus)) {
        mParameters.setFocusMode(Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);
    }

    mParameters.set(CameraUtil.RECORDING_HINT, CameraUtil.TRUE);

    // Enable video stabilization. Convenience methods not available in API
    // level <= 14
    String vstabSupported = mParameters.get("video-stabilization-supported");
    if ("true".equals(vstabSupported)) {
        mParameters.set("video-stabilization", "true");
    }

    // Set picture size.
    // The logic here is different from the logic in still-mode camera.
    // There we determine the preview size based on the picture size, but
    // here we determine the picture size based on the preview size.
    List<Size> supported = mParameters.getSupportedPictureSizes();
    Size optimalSize = CameraUtil.getOptimalVideoSnapshotPictureSize(supported,
            (double) mDesiredPreviewWidth / mDesiredPreviewHeight);
    Size original = mParameters.getPictureSize();
    if (!original.equals(optimalSize)) {
        mParameters.setPictureSize(optimalSize.width, optimalSize.height);
    }
    Log.v(TAG, "Video snapshot size is " + optimalSize.width + "x" +
            optimalSize.height);

    // Set JPEG quality.
    int jpegQuality = CameraProfile.getJpegEncodingQualityParameter(mCameraId,
            CameraProfile.QUALITY_HIGH);
    mParameters.setJpegQuality(jpegQuality);

    mCameraDevice.setParameters(mParameters);
    // Keep preview size up to date.
    mParameters = mCameraDevice.getParameters();

    // Update UI based on the new parameters.
    mUI.updateOnScreenIndicators(mParameters, mPreferences);
}
 
開發者ID:asm-products,項目名稱:nexus-camera,代碼行數:74,代碼來源:VideoModule.java


注:本文中的android.hardware.Camera.Parameters.WHITE_BALANCE_AUTO屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。