Search in sources :

Example 1 with GrayscaleTransformation

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);
    }
}
Also used : BlurTransformation(com.lodz.android.imageloader.glide.transformations.BlurTransformation) MaskTransformation(com.lodz.android.imageloader.glide.transformations.MaskTransformation) RoundedCornersTransformation(com.lodz.android.imageloader.glide.transformations.RoundedCornersTransformation) ColorFilterTransformation(com.lodz.android.imageloader.glide.transformations.ColorFilterTransformation) GrayscaleTransformation(com.lodz.android.imageloader.glide.transformations.GrayscaleTransformation) CropCircleTransformation(com.lodz.android.imageloader.glide.transformations.CropCircleTransformation) CropSquareTransformation(com.lodz.android.imageloader.glide.transformations.CropSquareTransformation) Transformation(com.bumptech.glide.load.Transformation) BlurTransformation(com.lodz.android.imageloader.glide.transformations.BlurTransformation) MaskTransformation(com.lodz.android.imageloader.glide.transformations.MaskTransformation) ArrayList(java.util.ArrayList) CropCircleTransformation(com.lodz.android.imageloader.glide.transformations.CropCircleTransformation) CropSquareTransformation(com.lodz.android.imageloader.glide.transformations.CropSquareTransformation) GrayscaleTransformation(com.lodz.android.imageloader.glide.transformations.GrayscaleTransformation) RoundedCornersTransformation(com.lodz.android.imageloader.glide.transformations.RoundedCornersTransformation) ColorFilterTransformation(com.lodz.android.imageloader.glide.transformations.ColorFilterTransformation)

Aggregations

Transformation (com.bumptech.glide.load.Transformation)1 BlurTransformation (com.lodz.android.imageloader.glide.transformations.BlurTransformation)1 ColorFilterTransformation (com.lodz.android.imageloader.glide.transformations.ColorFilterTransformation)1 CropCircleTransformation (com.lodz.android.imageloader.glide.transformations.CropCircleTransformation)1 CropSquareTransformation (com.lodz.android.imageloader.glide.transformations.CropSquareTransformation)1 GrayscaleTransformation (com.lodz.android.imageloader.glide.transformations.GrayscaleTransformation)1 MaskTransformation (com.lodz.android.imageloader.glide.transformations.MaskTransformation)1 RoundedCornersTransformation (com.lodz.android.imageloader.glide.transformations.RoundedCornersTransformation)1 ArrayList (java.util.ArrayList)1