Android 毕加索缓存返回转换图像而不是原始图像

Android 毕加索缓存返回转换图像而不是原始图像,android,picasso,image-caching,Android,Picasso,Image Caching,我在用毕加索做我的安卓应用。使用毕加索变换,我在应用程序的某些部分渲染了变换后的图像,但当我尝试在另一部分渲染图像时,我也得到了变换后的图像。如何使原始图像在不进行转换的情况下显示 下面是一个代码示例 String imageUrl = "http://path/image.png"; CustomTransformation *trans= new CustomTransformation(); Picasso.with(this).load(imageUrl).transform(tran

我在用毕加索做我的安卓应用。使用毕加索变换,我在应用程序的某些部分渲染了变换后的图像,但当我尝试在另一部分渲染图像时,我也得到了变换后的图像。如何使原始图像在不进行转换的情况下显示

下面是一个代码示例

String imageUrl = "http://path/image.png";

CustomTransformation *trans= new CustomTransformation();
Picasso.with(this).load(imageUrl).transform(trans).into(myImageView1);
Picasso.with(this).load(imageUrl).into(myImageView2);

在此之后,两个图像视图将显示图像,并将转换应用于这两个视图

可能您没有设置转换键,因此缓存机制看不到差异。 例如:

private Transformation blur=new Transformation(){
@凌驾
公共位图转换(位图源){
位图模糊=BitmapUtils.createBlurredBitmap(源);
source.recycle();
返回模糊;
}
@凌驾
公共字符串密钥(){
返回“模糊”;//这将添加到毕加索用于缓存的密钥中
}
};
//键:\n闪烁
void loadAndBlur(Uri、ImageView mPhoto){
毕加索。加载(uri)。转换(模糊)。转换为(mPhoto);
}
//关键:
无效加载(Uri、ImageView mPhoto){
加载(uri).into(mPhoto);
}

请提供一些代码@PatrickMA我添加了一些代码,现在更清楚了
private Transformation blur = new Transformation() {
    @Override
    public Bitmap transform(Bitmap source) {
        Bitmap blurred = BitmapUtils.createBlurredBitmap(source);
        source.recycle();
        return blurred;
    }

    @Override
    public String key() {
        return "blurred";   //this will be added to the key that Picasso uses for caching
    }
};
//key: <uri>\nblurred
void loadAndBlur(Uri uri, ImageView mPhoto) {
        picasso.load(uri).transform(blur).into(mPhoto);
}
//key: <uri>
void load(Uri uri, ImageView mPhoto) {
        picasso.load(uri).into(mPhoto);
}