0

I'm trying to draw an image on surface view, but it seems not to have the same quality as an original image. I'm doing it the following way:

mBackgroundBitmap = BitmapFactory.decodeResource(mResources, R.drawable.background);
canvas.drawBitmap(mBackgroundBitmap , null, new Rect(0, 0, surfaceSize.mWidth, surfaceSize.mHeight), null);

Where R.drawable.background is a BMP image

This is how it looks in the default Android viewer:
enter image description here

And in my app:
enter image description here

Any ideas how to do the same quality as on the first picture?

Denis
  • 2,786
  • 1
  • 14
  • 29
  • 1
    You can try with this https://stackoverflow.com/questions/10568188/android-bitmap-quality-issues – Sadegh J Jan 08 '21 at 12:38
  • Have tried, still not working. Image size is 400x400 and surface size is 810x810, but scaling is not smooth enough – Denis Jan 08 '21 at 13:13
  • have you tried with Picasso or Glide?? you can load image as Uri instead of bitmap. try with Picasso from here https://guides.codepath.com/android/Displaying-Images-with-the-Picasso-Library – Sadegh J Jan 08 '21 at 13:25
  • I wouldn't like to use any 3rdparty libs, I hope it is possible to do it with standard facilities – Denis Jan 08 '21 at 14:17
  • what is scaletype in imageview? try with changing that to fitXY or other scales. maybe helps – Sadegh J Jan 08 '21 at 14:22

0 Answers0