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


Java RoundingParams.setCornersRadius方法代码示例

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


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

示例1: createDraweeHierarchy

import com.facebook.drawee.generic.RoundingParams; //导入方法依赖的package包/类
/**
 * Creates the Hierarchy using the information into the Config
 *
 * @param context The Context
 * @param config  The Config object
 * @return The Hierarchy to use
 */
public static GenericDraweeHierarchy createDraweeHierarchy(
        final Context context,
        final Config config) {
  GenericDraweeHierarchyBuilder builder =
          new GenericDraweeHierarchyBuilder(context.getResources())
          .setFadeDuration(config.fadeDurationMs)
          .setPlaceholderImage(Const.PLACEHOLDER)
          .setFailureImage(Const.FAILURE)
          .setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER);
  applyScaleType(builder, config);

  if (config.useRoundedCorners || config.drawBorder) {
    final Resources res = context.getResources();
    final RoundingParams roundingParams = new RoundingParams();

    if (config.useRoundedCorners) {
      roundingParams.setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY);
      roundingParams.setCornersRadius(res.getDimensionPixelSize(R.dimen.drawee_corner_radius));
      roundingParams.setRoundAsCircle(config.useRoundedAsCircle);
    }

    if (config.drawBorder) {
      //noinspection deprecation
      roundingParams.setBorderColor(res.getColor(R.color.colorPrimary));
      roundingParams.setBorderWidth(res.getDimensionPixelSize(R.dimen.drawee_border_width));
    }

    builder.setRoundingParams(roundingParams);
  }
  return builder.build();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:39,代码来源:DraweeUtil.java

示例2: setRoundingParams

import com.facebook.drawee.generic.RoundingParams; //导入方法依赖的package包/类
/**
 * 设置图片的原角半径(原来为圆角的不能修改为圆圈,反之亦然)
 * @param radius 圆角半径
 * @return this
 */
public ImageLoaderUtil setRoundingParams(float radius){
    RoundingParams roundingParams = hierarchy.getRoundingParams();
    if(roundingParams == null){
        hierarchy.setRoundingParams(new RoundingParams().setCornersRadius(radius));
    }else{
        roundingParams.setCornersRadius(radius);
        hierarchy.setRoundingParams(roundingParams);
    }

    return this;
}
 
开发者ID:liu-xiao-dong,项目名称:JD-Test,代码行数:17,代码来源:ImageLoaderUtil.java

示例3: maybeUpdateView

import com.facebook.drawee.generic.RoundingParams; //导入方法依赖的package包/类
public void maybeUpdateView() {
  if (!mIsDirty) {
    return;
  }

  boolean doResize = shouldResize(mUri);
  if (doResize && (getWidth() <= 0 || getHeight() <=0)) {
    // If need a resize and the size is not yet set, wait until the layout pass provides one
    return;
  }

  GenericDraweeHierarchy hierarchy = getHierarchy();
  hierarchy.setActualImageScaleType(mScaleType);

  if (mLoadingImageDrawable != null) {
    hierarchy.setPlaceholderImage(mLoadingImageDrawable, ScalingUtils.ScaleType.CENTER);
  }

  boolean usePostprocessorScaling =
      mScaleType != ScalingUtils.ScaleType.CENTER_CROP &&
      mScaleType != ScalingUtils.ScaleType.FOCUS_CROP;
  float hierarchyRadius = usePostprocessorScaling ? 0 : mBorderRadius;

  RoundingParams roundingParams = hierarchy.getRoundingParams();
  roundingParams.setCornersRadius(hierarchyRadius);
  roundingParams.setBorder(mBorderColor, mBorderWidth);
  if (mOverlayColor != Color.TRANSPARENT) {
      roundingParams.setOverlayColor(mOverlayColor);
  } else {
      // make sure the default rounding method is used.
      roundingParams.setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY);
  }
  hierarchy.setRoundingParams(roundingParams);
  hierarchy.setFadeDuration(
      mFadeDurationMs >= 0
          ? mFadeDurationMs
          : mIsLocalImage ? 0 : REMOTE_IMAGE_FADE_DURATION_MS);

  Postprocessor postprocessor = usePostprocessorScaling ? mRoundedCornerPostprocessor : null;

  ResizeOptions resizeOptions = doResize ? new ResizeOptions(getWidth(), getHeight()) : null;

  ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(mUri)
      .setPostprocessor(postprocessor)
      .setResizeOptions(resizeOptions)
      .setAutoRotateEnabled(true)
      .setProgressiveRenderingEnabled(mProgressiveRenderingEnabled)
      .build();

  // This builder is reused
  mDraweeControllerBuilder.reset();

  mDraweeControllerBuilder
      .setAutoPlayAnimations(true)
      .setCallerContext(mCallerContext)
      .setOldController(getController())
      .setImageRequest(imageRequest);

  if (mControllerListener != null && mControllerForTesting != null) {
    ForwardingControllerListener combinedListener = new ForwardingControllerListener();
    combinedListener.addListener(mControllerListener);
    combinedListener.addListener(mControllerForTesting);
    mDraweeControllerBuilder.setControllerListener(combinedListener);
  } else if (mControllerForTesting != null) {
    mDraweeControllerBuilder.setControllerListener(mControllerForTesting);
  } else if (mControllerListener != null) {
    mDraweeControllerBuilder.setControllerListener(mControllerListener);
  }

  setController(mDraweeControllerBuilder.build());
  mIsDirty = false;
}
 
开发者ID:john1jan,项目名称:ReactNativeSignatureExample,代码行数:73,代码来源:ReactImageView.java

示例4: maybeUpdateView

import com.facebook.drawee.generic.RoundingParams; //导入方法依赖的package包/类
public void maybeUpdateView() {
  if (!mIsDirty) {
    return;
  }

  boolean doResize = shouldResize(mUri);
  if (doResize && (getWidth() <= 0 || getHeight() <=0)) {
    // If need a resize and the size is not yet set, wait until the layout pass provides one
    return;
  }

  GenericDraweeHierarchy hierarchy = getHierarchy();
  hierarchy.setActualImageScaleType(mScaleType);

  if (mLoadingImageDrawable != null) {
    hierarchy.setPlaceholderImage(mLoadingImageDrawable, ScalingUtils.ScaleType.CENTER);
  }

  boolean usePostprocessorScaling =
      mScaleType != ScalingUtils.ScaleType.CENTER_CROP &&
      mScaleType != ScalingUtils.ScaleType.FOCUS_CROP;

  RoundingParams roundingParams = hierarchy.getRoundingParams();

  if (usePostprocessorScaling) {
    roundingParams.setCornersRadius(0);
  } else {
    cornerRadii(sComputedCornerRadii);

    roundingParams.setCornersRadii(sComputedCornerRadii[0], sComputedCornerRadii[1], sComputedCornerRadii[2], sComputedCornerRadii[3]);
  }

  roundingParams.setBorder(mBorderColor, mBorderWidth);
  if (mOverlayColor != Color.TRANSPARENT) {
      roundingParams.setOverlayColor(mOverlayColor);
  } else {
      // make sure the default rounding method is used.
      roundingParams.setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY);
  }
  hierarchy.setRoundingParams(roundingParams);
  hierarchy.setFadeDuration(
      mFadeDurationMs >= 0
          ? mFadeDurationMs
          : mIsLocalImage ? 0 : REMOTE_IMAGE_FADE_DURATION_MS);

  Postprocessor postprocessor = usePostprocessorScaling ? mRoundedCornerPostprocessor : null;

  ResizeOptions resizeOptions = doResize ? new ResizeOptions(getWidth(), getHeight()) : null;

  ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(mUri)
      .setPostprocessor(postprocessor)
      .setResizeOptions(resizeOptions)
      .setAutoRotateEnabled(true)
      .setProgressiveRenderingEnabled(mProgressiveRenderingEnabled)
      .build();

  // This builder is reused
  mDraweeControllerBuilder.reset();

  mDraweeControllerBuilder
      .setAutoPlayAnimations(true)
      .setCallerContext(mCallerContext)
      .setOldController(getController())
      .setImageRequest(imageRequest);

  if (mControllerListener != null && mControllerForTesting != null) {
    ForwardingControllerListener combinedListener = new ForwardingControllerListener();
    combinedListener.addListener(mControllerListener);
    combinedListener.addListener(mControllerForTesting);
    mDraweeControllerBuilder.setControllerListener(combinedListener);
  } else if (mControllerForTesting != null) {
    mDraweeControllerBuilder.setControllerListener(mControllerForTesting);
  } else if (mControllerListener != null) {
    mDraweeControllerBuilder.setControllerListener(mControllerListener);
  }

  setController(mDraweeControllerBuilder.build());
  mIsDirty = false;
}
 
开发者ID:ManrajGrover,项目名称:react-native-box-loaders,代码行数:80,代码来源:ReactImageView.java

示例5: maybeUpdateView

import com.facebook.drawee.generic.RoundingParams; //导入方法依赖的package包/类
public void maybeUpdateView() {
        if (!mIsDirty) {
            return;
        }

        boolean doResize = shouldResize(mUri);
        if (doResize && (getWidth() <= 0 || getHeight() <=0)) {
            // If need a resize and the size is not yet set, wait until the layout pass provides one
            return;
        }

        GenericDraweeHierarchy hierarchy = getHierarchy();
        hierarchy.setActualImageScaleType(mScaleType);

        if (mLoadingImageDrawable != null) {
//            hierarchy.setPlaceholderImage(mLoadingImageDrawable, ScalingUtils.ScaleType.CENTER);
        }

        boolean usePostprocessorScaling =
                mScaleType != ScalingUtils.ScaleType.CENTER_CROP &&
                        mScaleType != ScalingUtils.ScaleType.FOCUS_CROP;
        float hierarchyRadius = usePostprocessorScaling ? 0 : mBorderRadius;

        RoundingParams roundingParams = hierarchy.getRoundingParams();
        roundingParams.setCornersRadius(hierarchyRadius);
        roundingParams.setBorder(mBorderColor, mBorderWidth);
        hierarchy.setRoundingParams(roundingParams);
        hierarchy.setFadeDuration(
                mFadeDurationMs >= 0
                        ? mFadeDurationMs
                        : mIsLocalImage ? 0 : REMOTE_IMAGE_FADE_DURATION_MS);

        Postprocessor postprocessor = usePostprocessorScaling ? mRoundedCornerPostprocessor : null;
        Postprocessor redMeshPostprocessor = new redMeshPostprocessor();

        ResizeOptions resizeOptions = doResize ? new ResizeOptions(getWidth(), getHeight()) : null;

        ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(mUri)
                .setPostprocessor(redMeshPostprocessor)
                .setResizeOptions(resizeOptions)
                .setAutoRotateEnabled(true)
                .setProgressiveRenderingEnabled(mProgressiveRenderingEnabled)
                .build();

        // This builder is reused
        mDraweeControllerBuilder.reset();

        mDraweeControllerBuilder
                .setAutoPlayAnimations(true)
                .setCallerContext(mCallerContext)
                .setOldController(getController())
                .setImageRequest(imageRequest);

        if (mControllerListener != null && mControllerForTesting != null) {
            ForwardingControllerListener combinedListener = new ForwardingControllerListener();
            combinedListener.addListener(mControllerListener);
            combinedListener.addListener(mControllerForTesting);
            mDraweeControllerBuilder.setControllerListener(combinedListener);
        } else if (mControllerForTesting != null) {
            mDraweeControllerBuilder.setControllerListener(mControllerForTesting);
        } else if (mControllerListener != null) {
            mDraweeControllerBuilder.setControllerListener(mControllerListener);
        }

        setController(mDraweeControllerBuilder.build());
        mIsDirty = false;
    }
 
开发者ID:NorthFoxz,项目名称:react-native-imagewand,代码行数:68,代码来源:RNImageWand.java

示例6: maybeUpdateView

import com.facebook.drawee.generic.RoundingParams; //导入方法依赖的package包/类
public void maybeUpdateView() {
    if (!mIsDirty) {
        return;
    }

    boolean doResize = shouldResize(mUri);
    if (doResize && (getWidth() <= 0 || getHeight() <= 0)) {
        // If need a resize and the size is not yet set, wait until the layout pass provides one
        return;
    }

    GenericDraweeHierarchy hierarchy = getHierarchy();
    hierarchy.setActualImageScaleType(mScaleType);

    if (mLoadingImageDrawable != null) {
        hierarchy.setPlaceholderImage(mLoadingImageDrawable, ScalingUtils.ScaleType.CENTER);
    }

    boolean usePostprocessorScaling =
            mScaleType != ScalingUtils.ScaleType.CENTER_CROP &&
                    mScaleType != ScalingUtils.ScaleType.FOCUS_CROP;
    float hierarchyRadius = usePostprocessorScaling ? 0 : mBorderRadius;

    RoundingParams roundingParams = hierarchy.getRoundingParams();
    roundingParams.setCornersRadius(hierarchyRadius);
    roundingParams.setBorder(mBorderColor, mBorderWidth);
    if (mOverlayColor != Color.TRANSPARENT) {
        roundingParams.setOverlayColor(mOverlayColor);
    } else {
        // make sure the default rounding method is used.
        roundingParams.setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY);
    }
    hierarchy.setRoundingParams(roundingParams);
    hierarchy.setFadeDuration(
            mFadeDurationMs >= 0
                    ? mFadeDurationMs
                    : mIsLocalImage ? 0 : REMOTE_IMAGE_FADE_DURATION_MS);

    Postprocessor postprocessor = usePostprocessorScaling ? mRoundedCornerPostprocessor : null;

    ResizeOptions resizeOptions = doResize ? new ResizeOptions(getWidth(), getHeight()) : null;

    ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(mUri)
            .setPostprocessor(postprocessor)
            .setResizeOptions(resizeOptions)
            .setAutoRotateEnabled(true)
            .setProgressiveRenderingEnabled(mProgressiveRenderingEnabled)
            .build();

    // This builder is reused
    mDraweeControllerBuilder.reset();

    mDraweeControllerBuilder
            .setAutoPlayAnimations(true)
            .setCallerContext(mCallerContext)
            .setOldController(getController())
            .setImageRequest(imageRequest);

    if (mControllerListener != null && mControllerForTesting != null) {
        ForwardingControllerListener combinedListener = new ForwardingControllerListener();
        combinedListener.addListener(mControllerListener);
        combinedListener.addListener(mControllerForTesting);
        mDraweeControllerBuilder.setControllerListener(combinedListener);
    } else if (mControllerForTesting != null) {
        mDraweeControllerBuilder.setControllerListener(mControllerForTesting);
    } else if (mControllerListener != null) {
        mDraweeControllerBuilder.setControllerListener(mControllerListener);
    }

    setController(mDraweeControllerBuilder.build());
    mIsDirty = false;
}
 
开发者ID:bylevel,项目名称:react-native-image-android,代码行数:73,代码来源:ImageAndroidView.java


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