画在画布上顺利缩放位图 [英] Draw smoothly scaled bitmaps on Canvas
本文介绍了画在画布上顺利缩放位图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我怎么画位图
在画布
在我的Android应用:
This is how I draw Bitmap
on Canvas
in my Android app:
canvas.save();
canvas.scale(scale, scale, x, y);
canvas.drawBitmap(bitmap, x, y, null);
canvas.restore();
然而位图
不能顺利缩放,无抗锯齿进行。如何启用抗锯齿?
However the Bitmap
is not scaled smoothly, no antialiasing is performed. How can I enable antialiasing?
推荐答案
试试这个:
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setFilterBitmap(true);
paint.setDither(true);
canvas.drawBitmap(bitmap, x, y, paint);
这篇关于画在画布上顺利缩放位图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文