Picasso-transformation___图片的滤镜效果

导包

    //picasso
    compile 'com.squareup.picasso:picasso:2.5.2'
    //picasso-transformations
    compile 'jp.wasabeef:picasso-transformations:2.1.2'
    //GPU Filters
    compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.4.1'

使用方法

        mContext=this;
        iv = (ImageView) findViewById(R.id.iv);
        Picasso.with(this).load(pic_umr)//.resize(300,300)
                //将图片切割成特定的形状
                .transform(new MaskTransformation(this, R.drawable.mask_starfish))
                //同上,但前景是9.图
                .transform(new MaskTransformation(this, R.drawable.chat_me_mask))
                //单纯的重新裁剪图片
                .transform(new CropTransformation(300, 100))
                //裁剪图片,前两个参数是裁剪后的图片的大小.后两个参数是当图片不能完全展示时显示哪个部分的图片
                .transform(new CropTransformation(300, 100, CropTransformation.GravityHorizontal.RIGHT,
                        CropTransformation.GravityVertical.CENTER))
                //按比例裁剪图片,width/height
                .transform(new CropTransformation((float)0.5,CropTransformation.GravityHorizontal.RIGHT,
                                                CropTransformation.GravityVertical.CENTER))
                //将图片裁剪成正方形
                .transform(new CropSquareTransformation())
                //将图片裁剪成圆形
                .transform(new CropCircleTransformation())
                //加颜色的滤镜
                .transform(new ColorFilterTransformation(Color.argb(80, 255, 0, 0)))
                //加灰色的滤镜>>黑白照片
                .transform(new GrayscaleTransformation())
                //加特定位置和样式的圆角
                .transform(new RoundedCornersTransformation(30, 0,
                        RoundedCornersTransformation.CornerType.DIAGONAL_FROM_TOP_LEFT))
                //雾
                .transform(new BlurTransformation(this, 4, 5))
                //卡通滤镜>>热血动漫的效果
                .transform(new ToonFilterTransformation(this))
                //灰白黄的滤镜
                .transform(new SepiaFilterTransformation(this))
                //对比度增强
                .transform(new ContrastFilterTransformation(this, 2.0f))
                //颜色翻转滤镜
                .transform(new InvertFilterTransformation(this))
                //马赛克
                .transform(new PixelationFilterTransformation(this, 20))
                //素描效果
                .transform(new SketchFilterTransformation(mContext))
                //漩涡扭曲效果
                .transform(new SwirlFilterTransformation(mContext, 0.5f, 1.0f, new PointF(0.5f, 0.5f)))
                //过渡曝光效果
                .transform(new BrightnessFilterTransformation(mContext, 0.5f))
                //颜料画效果
                .transform(new KuwaharaFilterTransformation(mContext, 25))
                //周围加个黑色圆圈,增强视觉冲击力的效果
                .transform(new VignetteFilterTransformation(mContext, new PointF(0.5f, 0.5f),
                        new float[] { 0.0f, 0.0f, 0.0f }, 0f, 0.75f))
                .into(iv);
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值