Scaling bitmaps on SurfaceView = no antialiasing?

▼魔方 西西 提交于 2019-12-23 00:23:11

问题


I am trying to scale DOWN a high resolution .png bitmap on my SurfaceView canvas like so:

Bitmap player = BitmapFactory.decodeResource(getResources(), R.drawable.player);
Paint paint;
paint.setAntiAlias(true);
paint.setDither(true);
paint.setFilterBitmap(true);
paint.setFlags(Paint.ANTI_ALIAS_FLAG);
//then in onDraw:
canvas.drawBitmap(player, null, frame, paint);

The problem is that the antialiasing works perfectly when I use a View, but it fails to work when I use a SurfaceView, and the quality looks horrible. I've tried everything. Some guy even posted this question 3 years ago on various sites (even here) and there was no resolution. Does anyone have any ideas?

Here is the original question the guy posted: Drawing scaled bitmaps on a SurfaceView -- no antialiasing

来源:https://stackoverflow.com/questions/24419942/scaling-bitmaps-on-surfaceview-no-antialiasing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!