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


Java RoundedCorners类代码示例

本文整理汇总了Java中com.bumptech.glide.load.resource.bitmap.RoundedCorners的典型用法代码示例。如果您正苦于以下问题:Java RoundedCorners类的具体用法?Java RoundedCorners怎么用?Java RoundedCorners使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RoundedCorners类属于com.bumptech.glide.load.resource.bitmap包,在下文中一共展示了RoundedCorners类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testRoundedCorners_usePool

import com.bumptech.glide.load.resource.bitmap.RoundedCorners; //导入依赖的package包/类
@Test
public void testRoundedCorners_usePool() throws ExecutionException, InterruptedException {
  canonicalBitmap = canonicalBitmap.scale(0.1f);

  Bitmap redRect =
      createRect(
          Color.RED,
          canonicalBitmap.getWidth(),
          canonicalBitmap.getHeight(),
          Bitmap.Config.ARGB_8888);

  Glide.get(context).getBitmapPool().put(redRect);

  Bitmap roundedRect = bitmapRegressionTester.test(
      GlideApp.with(context)
          .asBitmap()
          .load(canonicalBitmap.getBitmap())
          .override(canonicalBitmap.getWidth(), canonicalBitmap.getHeight())
          .transform(new RoundedCorners(5)));

  assertThat(roundedRect).isEqualTo(redRect);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:RoundedCornersRegressionTest.java

示例2: setupGlideOptions

import com.bumptech.glide.load.resource.bitmap.RoundedCorners; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void setupGlideOptions() {
   	options = new RequestOptions();
   	
   	if (isShapeCircle) {
   		if (Defaults.CIRCLE_RADIUS > 0) {
   			options.transforms(new CenterCrop(), new RoundedCorners(Defaults.CIRCLE_RADIUS));
   			
   		} else { 
   			options.circleCrop();
   		}
   	} 
   	
   	options.override(Defaults.IMAGE_HEIGHT, Defaults.IMAGE_HEIGHT);
   	options.placeholder(placeholder_image);
   	options.priority(Priority.HIGH);
}
 
开发者ID:prashantsaini1,项目名称:titanium-android-imagepicker,代码行数:18,代码来源:ImageViewerActivity.java

示例3: setupGlideOptions

import com.bumptech.glide.load.resource.bitmap.RoundedCorners; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void setupGlideOptions() {
   	options = new RequestOptions();
   	int size;
   	
   	if (isShapeCircle) {
   		if (Defaults.CIRCLE_RADIUS > 0) {
   			size = (int) (0.65 * Defaults.IMAGE_HEIGHT);
   			options.transforms(new CenterCrop(), new RoundedCorners(Defaults.CIRCLE_RADIUS));
   			
   		} else { 
   			size = Defaults.IMAGE_HEIGHT;
   			options.circleCrop();
   		}
   		
   	} else {
   		size = (int) (0.65 * Defaults.IMAGE_HEIGHT); 
   	}
   	
   	options.override(size, size);
   	options.error(error_image);
   	options.priority(Priority.HIGH);
   }
 
开发者ID:prashantsaini1,项目名称:titanium-android-imagepicker,代码行数:24,代码来源:ImagePickerActivity.java

示例4: load_withShapeDrawableResourceId_asDrawable_withTransformation_validSize_succeeds

import com.bumptech.glide.load.resource.bitmap.RoundedCorners; //导入依赖的package包/类
@Test
public void load_withShapeDrawableResourceId_asDrawable_withTransformation_validSize_succeeds()
    throws ExecutionException, InterruptedException {
  Drawable drawable = Glide.with(context)
      .load(ResourceIds.drawable.shape_drawable)
      .apply(bitmapTransform(new RoundedCorners(10)))
      .submit(100, 200)
      .get();
  assertThat(drawable).isNotNull();
  assertThat(drawable.getIntrinsicWidth()).isEqualTo(100);
  assertThat(drawable.getIntrinsicHeight()).isEqualTo(200);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:NonBitmapDrawableResourcesTest.java

示例5: testRoundedCorners

import com.bumptech.glide.load.resource.bitmap.RoundedCorners; //导入依赖的package包/类
@Test
public void testRoundedCorners() throws ExecutionException, InterruptedException {
  bitmapRegressionTester.test(
      GlideApp.with(context)
          .asBitmap()
          .load(canonicalBitmap.getBitmap())
          .transform(new RoundedCorners(5)));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:RoundedCornersRegressionTest.java

示例6: testRoundedCorners_overRounded

import com.bumptech.glide.load.resource.bitmap.RoundedCorners; //导入依赖的package包/类
@Test
public void testRoundedCorners_overRounded() throws ExecutionException, InterruptedException {
  bitmapRegressionTester.test(
      GlideApp.with(context)
          .asBitmap()
          .load(canonicalBitmap.getBitmap())
          .transform(new RoundedCorners(20)));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:RoundedCornersRegressionTest.java

示例7: GlideManager

import com.bumptech.glide.load.resource.bitmap.RoundedCorners; //导入依赖的package包/类
public GlideManager(Builder builder){
    RequestOptions options = new RequestOptions()
            .placeholder(builder.placeresid);

    if (builder.eroorresid != 0){
        options.error(builder.eroorresid);
    }


    switch (builder.type){
        case BITMAP_SCAN_CENTERN:
            options.centerCrop();
            break;
        case BITMAP_SCAN_FIT:
            options.fitCenter();
            break;
        default:
            break;
    }
    if (builder.setCircleCrop){
        options.circleCrop();
    }
    if (builder.radius != 0){
        options.transform(new RoundedCorners(builder.radius));
    }

    RequestBuilder requestBuilder = null;

    requestBuilder = Glide.with(builder.context).load(builder.source);

    if (builder.animtime > 0){
        requestBuilder.transition(new DrawableTransitionOptions().crossFade(builder.animtime));
    }

    requestBuilder.apply(options)
            .listener(new LoadListener())
            .into(builder.imageView);


}
 
开发者ID:LillteZheng,项目名称:ViewPagerHelper,代码行数:41,代码来源:GlideManager.java

示例8: loadRoundImg

import com.bumptech.glide.load.resource.bitmap.RoundedCorners; //导入依赖的package包/类
/**
 * 加载圆角图片
 *
 * @param obj                 加载的图片资源
 * @param iv
 * @param dp                  圆角尺寸-dp
 * @param placeholderResource -占位图
 * @param isOfficial-是否官方模式圆角
 */
public static void loadRoundImg(Object obj, ImageView iv, float dp, int placeholderResource, boolean isOfficial) {
    Glide.with(iv.getContext()).load(obj).apply(getRequestOptions()
            .error(placeholderResource)
            .placeholder(placeholderResource)
            .fallback(placeholderResource)
            .dontAnimate()
            .transform(isOfficial ? new RoundedCorners(dp2px(dp)) : new GlideRoundTransform(iv.getContext(), dp2px(dp)))).into(iv);
}
 
开发者ID:AriesHoo,项目名称:TitleBarView,代码行数:18,代码来源:GlideManager.java

示例9: loadRoundImg

import com.bumptech.glide.load.resource.bitmap.RoundedCorners; //导入依赖的package包/类
/**
 * 加载圆角图片
 *
 * @param obj                 加载的图片资源
 * @param iv
 * @param dp                  圆角尺寸-dp
 * @param placeholder         -占位图
 * @param isOfficial-是否官方模式圆角
 */
public static void loadRoundImg(Object obj, ImageView iv, float dp, Drawable placeholder, boolean isOfficial) {
    Glide.with(iv.getContext()).load(obj).apply(getRequestOptions()
            .error(placeholder)
            .placeholder(placeholder)
            .fallback(placeholder)
            .dontAnimate()
            .transform(isOfficial ? new RoundedCorners(dp2px(dp)) : new GlideRoundTransform(iv.getContext(), dp2px(dp)))).into(iv);
}
 
开发者ID:AriesHoo,项目名称:FastLib,代码行数:18,代码来源:GlideManager.java


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