Picasso-transformation___图片的滤镜效果

来源:互联网 发布:托福听力评分标准知乎 编辑:程序博客网 时间:2024/06/06 20:51

导包

    //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);
原创粉丝点击