android.util.Rational#getNumerator ( )源码实例Demo

下面列出了android.util.Rational#getNumerator ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: mollyim-android   文件: CameraXUtil.java
@TargetApi(21)
public static @NonNull Size buildResolutionForRatio(int longDimension, @NonNull Rational ratio, boolean isPortrait) {
  int shortDimension = longDimension * ratio.getDenominator() / ratio.getNumerator();

  if (isPortrait) {
    return new Size(shortDimension, longDimension);
  } else {
    return new Size(longDimension, shortDimension);
  }
}
 
源代码2 项目: Camera2   文件: OneCameraCharacteristicsImpl.java
@Override
public float getExposureCompensationStep()
{
    if (!isExposureCompensationSupported())
    {
        return -1.0f;
    }
    Rational compensationStep = mCameraCharacteristics.get(
            CameraCharacteristics.CONTROL_AE_COMPENSATION_STEP);
    return (float) compensationStep.getNumerator() / compensationStep.getDenominator();
}
 
源代码3 项目: Camera2   文件: AndroidCamera2Capabilities.java
AndroidCamera2Capabilities(CameraCharacteristics p) {
    super(new Stringifier());

    StreamConfigurationMap s = p.get(SCALER_STREAM_CONFIGURATION_MAP);

    for (Range<Integer> fpsRange : p.get(CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES)) {
        mSupportedPreviewFpsRange.add(new int[] { fpsRange.getLower(), fpsRange.getUpper() });
    }

    // TODO: We only support TextureView preview rendering
    mSupportedPreviewSizes.addAll(Size.buildListFromAndroidSizes(Arrays.asList(
            s.getOutputSizes(SurfaceTexture.class))));
    for (int format : s.getOutputFormats()) {
        mSupportedPreviewFormats.add(format);
    }

    // TODO: We only support MediaRecorder video capture
    mSupportedVideoSizes.addAll(Size.buildListFromAndroidSizes(Arrays.asList(
            s.getOutputSizes(MediaRecorder.class))));

    // TODO: We only support JPEG image capture
    mSupportedPhotoSizes.addAll(Size.buildListFromAndroidSizes(Arrays.asList(
            s.getOutputSizes(ImageFormat.JPEG))));
    mSupportedPhotoFormats.addAll(mSupportedPreviewFormats);

    buildSceneModes(p);
    buildFlashModes(p);
    buildFocusModes(p);
    buildWhiteBalances(p);
    // TODO: Populate mSupportedFeatures

    // TODO: Populate mPreferredPreviewSizeForVideo

    Range<Integer> ecRange = p.get(CONTROL_AE_COMPENSATION_RANGE);
    mMinExposureCompensation = ecRange.getLower();
    mMaxExposureCompensation = ecRange.getUpper();

    Rational ecStep = p.get(CONTROL_AE_COMPENSATION_STEP);
    mExposureCompensationStep = (float) ecStep.getNumerator() / ecStep.getDenominator();

    mMaxNumOfFacesSupported = p.get(STATISTICS_INFO_MAX_FACE_COUNT);
    mMaxNumOfMeteringArea = p.get(CONTROL_MAX_REGIONS_AE);

    mMaxZoomRatio = p.get(SCALER_AVAILABLE_MAX_DIGITAL_ZOOM);
    // TODO: Populate mHorizontalViewAngle
    // TODO: Populate mVerticalViewAngle
    // TODO: Populate mZoomRatioList
    // TODO: Populate mMaxZoomIndex

    if (supports(FocusMode.AUTO)) {
        mMaxNumOfFocusAreas = p.get(CONTROL_MAX_REGIONS_AF);
        if (mMaxNumOfFocusAreas > 0) {
            mSupportedFeatures.add(Feature.FOCUS_AREA);
        }
    }
    if (mMaxNumOfMeteringArea > 0) {
        mSupportedFeatures.add(Feature.METERING_AREA);
    }

    if (mMaxZoomRatio > CameraCapabilities.ZOOM_RATIO_UNZOOMED) {
        mSupportedFeatures.add(Feature.ZOOM);
    }

    // TODO: Detect other features
}
 
 方法所在类
 同类方法