use of com.lodz.android.imageloader.glide.transformations.GrayscaleTransformation in project AgileDev by LZ9.
the class GlideImageLoader method setTransformation.
/**
* 对图片进行变换
*/
@SuppressWarnings("unchecked")
private void setTransformation(Context context, DrawableTypeRequest request, GlideBuilderBean bean) {
List<Transformation<Bitmap>> list = new ArrayList<>();
if (bean.useBlur) {
list.add(new BlurTransformation(context, bean.blurRadius));
}
if (bean.useFilterColor) {
list.add(new ColorFilterTransformation(context, bean.filterColor));
}
if (bean.useRoundCorner) {
list.add(new RoundedCornersTransformation(context, (int) bean.roundCornerRadius, bean.roundedCornersMargin, bean.cornerType));
}
if (bean.useGrayscale) {
list.add(new GrayscaleTransformation(context));
}
if (bean.useCircle) {
list.add(new CropCircleTransformation(context));
}
if (bean.useCropSquare) {
list.add(new CropSquareTransformation(context));
}
if (bean.useMask) {
list.add(new MaskTransformation(context, bean.maskResId));
}
if (list.size() > 0) {
Transformation[] transformations = new Transformation[list.size()];
for (int i = 0; i < list.size(); i++) {
transformations[i] = list.get(i);
}
request.bitmapTransform(transformations);
}
}
Aggregations