Java Code Examples for com.bumptech.glide.request.RequestOptions#transform()
The following examples show how to use
com.bumptech.glide.request.RequestOptions#transform() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProjectUtils.java From DevUtils with Apache License 2.0 | 5 votes |
/** * 获取圆角 RequestOptions * @return 圆角 {@link RequestOptions} */ public static RequestOptions getRoundOptions10() { // 获取默认 RequestOptions RequestOptions roundOptions = GlideUtils.defaultOptions(); // 设置圆角, 使用 RoundedCorners 图片不会闪烁 return roundOptions.transform(new RoundedCorners(ResourceUtils.getDimensionInt(R.dimen.un_radius_10))); }
Example 2
Source File: GlideUtils.java From DevUtils with Apache License 2.0 | 5 votes |
/** * 获取图片处理效果加载配置 * @param options {@link RequestOptions} * @param transformation {@link Transformation} 图形效果 * @return {@link RequestOptions} */ public static RequestOptions transformationOptions(final RequestOptions options, final Transformation transformation) { if (options != null) { try { options.transform(transformation); } catch (Exception e) { LogPrintUtils.eTag(TAG, e, "transformationOptions"); } } return options; }
Example 3
Source File: PickerLoader.java From VMLibrary with Apache License 2.0 | 5 votes |
/** * 通过上下文对象加载图片 * * @param context 上下文对象 * @param options 加载配置 * @param imageView 目标控件 */ @Override public void load(Context context, Options options, ImageView imageView) { RequestOptions requestOptions = new RequestOptions(); if (options.isCircle) { requestOptions.circleCrop(); } else if (options.isRadius) { requestOptions.transform(new MultiTransformation<>(new CenterCrop(), new RoundedCorners(options.radiusSize))); } GlideApp.with(context).load(options.url).apply(requestOptions).into(imageView); }
Example 4
Source File: GlideLoader.java From XDroidMvp with MIT License | 5 votes |
@Override public void loadCorner(String url, final ImageView target, int radius, Options options) { RequestOptions requestOptions = wrapScaleType(options); //设置图片圆角角度 MultiTransformation multiTransformation = new MultiTransformation<Bitmap>(new CenterCrop(), new RoundedCorners(radius)); requestOptions.transform(multiTransformation); getRequestManager(target.getContext()) .load(url) .apply(requestOptions) .transition(withCrossFade()) .into(target); }
Example 5
Source File: GlideImageLoader.java From NIM_Android_UIKit with MIT License | 5 votes |
private static void displayAlbum(ImageView imageView, String path, Transformation<Bitmap> transformation, int placeHoder) { Context context = imageView.getContext(); RequestOptions options = new RequestOptions().error(placeHoder).placeholder(placeHoder).diskCacheStrategy( DiskCacheStrategy.RESOURCE); if (transformation != null) { options = options.transforms(new CenterCrop(), transformation); } else { options = options.transform(new CenterCrop()); } Glide.with(context).asDrawable().apply(options).load(Uri.fromFile(new File(path))).into(imageView); }