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


Java BitmapTransformation类代码示例

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


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

示例1: display

import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; //导入依赖的package包/类
/**
 * 显示图片
 * @param context     上下文
 * @param imageView   图片view
 * @param uri         图片路径
 * @param bitmapTransformation bitmap转换器
 */
private static void display(Context context, final ImageView imageView, String uri, BitmapTransformation bitmapTransformation, boolean isAvatar){
    DrawableTypeRequest<String> drawableTypeRequest = Glide.with(context).load(uri);
    drawableTypeRequest
            .centerCrop()
            .placeholder(ERROR_IMAGE)
            .error(isAvatar ? AVATAR_IMAGE : ERROR_IMAGE)
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .dontAnimate();

    // 添加转换器
    if(null != bitmapTransformation){
        drawableTypeRequest.bitmapTransform(bitmapTransformation);
    }

    // 设置图片
    drawableTypeRequest.into(imageView);
}
 
开发者ID:hcw2175,项目名称:GankEssence,代码行数:25,代码来源:ImagesUtil.java

示例2: loadImage

import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; //导入依赖的package包/类
private void loadImage(ImageView iv, int resid) {
        Glide
                .with(this)
//                .load(url)
                .load(resid)
//                .fitCenter() //缩放在view中,图的中心点与view的中心点匹配  全图可见
                .centerCrop()  //缩放,一边贴view的边,就停止
                .placeholder(R.mipmap.ic_launcher) //占位图
//                .error(resid)  //错误图
                .crossFade() //淡入
                .override(1000, 800) //图片尺寸
                .transform(new BitmapTransformation(this) {
                    @Override
                    protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {
                        Bitmap bitmap = Bitmap.createBitmap(toTransform, 0, 300, outWidth, outHeight-300);
                        return bitmap;
                    }

                    @Override
                    public String getId() {
                        return "aa";
                    }
                })
                .diskCacheStrategy(DiskCacheStrategy.RESULT) //ALL=SOURCE+RESULT  SOURCE原图尺寸 RESULT所以转化后的尺寸 NONE不缓存
                .into(iv);
    }
 
开发者ID:XinRan5312,项目名称:QxGradleConfig,代码行数:27,代码来源:MainActivity.java

示例3: handleUserAvatar

import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; //导入依赖的package包/类
public void handleUserAvatar(ImageView avatarIV, String url) {
    if (mDefaultAvatar == null) {
        Bitmap defaultAvatar = BitmapFactory.decodeResource(getResources(), R.drawable.default_avatar);
        mDefaultAvatar = new BitmapDrawable(getResources(), ImageUtil.toRoundCorner(defaultAvatar, 2));
    }

    avatarIV.setImageTintList(null);
    GlideApp.with(this)
            .load(url)
            .placeholder(mDefaultAvatar)
            .diskCacheStrategy(DiskCacheStrategy.RESOURCE)
            .transforms(new BitmapTransformation() {
                @Override
                protected Bitmap transform(@NonNull BitmapPool bitmapPool, @NonNull Bitmap bitmap, int i, int i1) {
                    Bitmap roundBitmap = ImageUtil.toRoundCorner(bitmap, 2);
                    bitmapPool.put(roundBitmap);
                    return roundBitmap;
                }

                @Override
                public void updateDiskCacheKey(MessageDigest messageDigest) {

                }
            })
            .into(avatarIV);
}
 
开发者ID:ymback,项目名称:NGA-CLIENT-VER-OPEN-SOURCE,代码行数:27,代码来源:BoardFragment.java

示例4: setProfileImage

import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; //导入依赖的package包/类
@Override
public void setProfileImage(String url){
    Glide.with(this)
            .load(url)
            .asBitmap()
            .centerCrop()
            .placeholder(R.drawable.profile_placeholder)
            .transform(new BitmapTransformation(this) {
                @Override
                protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {
                    return getCircleBitmap(toTransform);
                }

                @Override
                public String getId() {
                    return "circle";
                }
            })
            .into(mHeaderProfileImage);
}
 
开发者ID:plusCubed,项目名称:plusTimer,代码行数:21,代码来源:DrawerActivity.java

示例5: into

import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; //导入依赖的package包/类
public static void into(Activity activity, Object resPath, ImageView iv, BitmapTransformation bt) {
    if (!AppUtil.isSafe(activity)) {
        return;
    }
    if (resPath == null) {
        return;
    }
    if (bt == null) {
        Glide.with(activity).load(resPath).into(iv);
    } else {
        Glide.with(activity).load(resPath).transform(bt).into(iv);
    }
}
 
开发者ID:wzc25151,项目名称:lrs_android,代码行数:14,代码来源:GlideUtil.java

示例6: load

import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; //导入依赖的package包/类
@Override
public void load(ImageView imageView, Object imageUrl, Object transformation) {
    Glide.with(mContext)
            .load(imageUrl)
            .crossFade()
            .transform((BitmapTransformation) transformation)
            .into(imageView);
}
 
开发者ID:youth5201314,项目名称:XFrame,代码行数:9,代码来源:GlideImageLoader.java

示例7: displayImage

import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; //导入依赖的package包/类
public static void displayImage(Context context, ImageView imageView, String url, int placeHolder, BitmapTransformation transformation){
    test(url);
    Glide
            .with(context)
            .load(url)
            .diskCacheStrategy(DiskCacheStrategy.SOURCE)
            .transform(transformation)
            .placeholder(placeHolder)
            .dontAnimate()
            .into(imageView);
}
 
开发者ID:Sherchen,项目名称:LikeWechatPhotoViewer,代码行数:12,代码来源:GlideUtils.java

示例8: loadResourceImage

import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; //导入依赖的package包/类
public static void loadResourceImage(Context context, ImageView view, int resId,
                                     @Nullable BitmapTransformation transformation) {
    DrawableRequestBuilder<Integer> request = Glide
            .with(context)
            .load(resId)
            .dontAnimate()
            .diskCacheStrategy(DiskCacheStrategy.SOURCE);
    if (transformation != null) {
        request.transform(transformation);
    }
    request.into(view);
}
 
开发者ID:WangDaYeeeeee,项目名称:Mysplash,代码行数:13,代码来源:ImageHelper.java

示例9: loadImage

import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; //导入依赖的package包/类
@Override
public void loadImage(String url, final ImageView imageView) {
    Glide.with(imageView.getContext()).load(url).transform(new BitmapTransformation(imageView.getContext()) {
        @Override
        protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {
            BlurTransformation blurTransformation = new BlurTransformation(imageView.getContext());
            Resource<Bitmap> blurredBitmapResource = blurTransformation.transform(BitmapResource.obtain(toTransform, pool), 10, 1);

            Bitmap combinedBitmap;
            Bitmap bottom = blurredBitmapResource.get();

            if ((combinedBitmap = pool.get(toTransform.getWidth(), bottom.getHeight() / 3 + toTransform.getHeight(), Bitmap.Config.ARGB_8888)) == null) {
                combinedBitmap = Bitmap.createBitmap(toTransform.getWidth(), bottom.getHeight() / 3 + toTransform.getHeight(), toTransform.getConfig());
            }

            Canvas comboImage = new Canvas(combinedBitmap);
            comboImage.drawBitmap(toTransform, 0f, 0f, null);

            Matrix matrix = new Matrix();
            matrix.postRotate(180);
            matrix.preScale(-1 , 1);
            matrix.postTranslate(0, toTransform.getHeight() * 2);

            comboImage.setMatrix(matrix);
            comboImage.drawBitmap(bottom, 0f, 0f, null);

            return BitmapResource.obtain(combinedBitmap, pool).get();
        }

        @Override
        public String getId() {
            return ImageLoader.class.getName() + ".Transformation";
        }
    }).into(imageView);
}
 
开发者ID:shelajev,项目名称:Retrofit2SampleApp,代码行数:36,代码来源:ImageLoader.java

示例10: getTransformation

import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; //导入依赖的package包/类
public BitmapTransformation getTransformation() {
    return transformation;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:GlideImageConfig.java

示例11: getTransformation

import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; //导入依赖的package包/类
public BitmapTransformation[] getTransformation() {
    return transformation;
}
 
开发者ID:BaoBaoJianqiang,项目名称:CustomListView,代码行数:4,代码来源:GlideImageConfig.java

示例12: getTransformation

import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; //导入依赖的package包/类
/**
 * glide用它来改变图形的形状
 */
public BitmapTransformation getTransformation() {
    return transformation;
}
 
开发者ID:wzx54321,项目名称:XinFramework,代码行数:7,代码来源:GlideImageConfig.java

示例13: loadRoundRect

import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; //导入依赖的package包/类
public static void loadRoundRect(
        Context context, String url,
        BitmapTransformation transformation, ImageView view) {
    Glide.with(context).load(url)
            .into(view);
}
 
开发者ID:yinyiliang,项目名称:RabbitCloud,代码行数:7,代码来源:LoaderImage.java

示例14: loadImageRotated

import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; //导入依赖的package包/类
public static void loadImageRotated(Context context, ImageView view, String url, int placeHolder, BitmapTransformation... transformations) {
    Glide.with(context)
            .load(url)
            .transform(transformations).placeholder(placeHolder)
            .into(view);
}
 
开发者ID:dscn,项目名称:ktball,代码行数:7,代码来源:GlideHelper.java

示例15: load

import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; //导入依赖的package包/类
public static void load(Context context, ImageView view, String url, BitmapTransformation transformation, int placeHolder) {
    getDrawableTypeRequest(context, url).placeholder(placeHolder)
            .transform(transformation)
            .crossFade()
            .into(view);
}
 
开发者ID:850759383,项目名称:ZhihuDailyNews,代码行数:7,代码来源:ImageLoader.java


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