如何切换滑翔变换平滑?

时间:2022-06-24 09:18:57

I used glide-transformations library for implement image processing But this code not working smooth. The image disappears once and then reappears. Because of no caching for refresh image. I want change like this video - brightness filter I want to show the change in the image while still changing the filter effect to the same image. So what should I do?

我使用了滑翔转换库来实现图像处理,但是这段代码并不流畅。图像消失一次,然后重新出现。因为没有缓存刷新图像。我想要改变像这个视频-亮度过滤器我想显示图像的变化,同时仍然改变滤镜的效果到相同的图像。那么我该怎么做呢?

//for refresh, not use caching
val requestOptions = RequestOptions()
     .diskCacheStrategy(DiskCacheStrategy.NONE)
     .skipMemoryCache(true)

Glide.with(this@ImageProcessingActivity)
     .load(imageUri)
     .apply(requestOptions)
     .into(binding.imageView)

binding.imageProcessingCardViewBackground.setOnClickListener {
    testBrightness += 0.1f

    Glide.with(this@ImageProcessingActivity)
          .load(imageUri)
          .apply(bitmapTransform(MultiTransformation(BlurTransformation(5), BrightnessFilterTransformation(testBrightness)
     )))
    .apply(requestOptions)
    .into(binding.imageView)
}

1 个解决方案

#1


0  

Please try below code.

请尝试以下代码。

Glide.with(context)
                .load(url)
                .placeholder(R.drawable.ic_placeholder)
                .error(R.drawable.ic_placeholder)
                .crossFade(300)
                .diskCacheStrategy(DiskCacheStrategy.SOURCE)
                .into(view);

#1


0  

Please try below code.

请尝试以下代码。

Glide.with(context)
                .load(url)
                .placeholder(R.drawable.ic_placeholder)
                .error(R.drawable.ic_placeholder)
                .crossFade(300)
                .diskCacheStrategy(DiskCacheStrategy.SOURCE)
                .into(view);