我尝试像这样调整图像的大小:
aPaint.setAntiAlias(true); // Enabling this flag will cause all draw operations that support antialiasing to use it.
aPaint.setFilterBitmap(True); // enable bilinear sampling on scaled bitmaps. If cleared, scaled bitmaps will be drawn with nearest neighbor sampling, likely resulting in artifacts.
apaint.setDither(true); // Enabling this flag applies a dither to any blit operation where the target's colour space is more constrained than the source.
aCanvas.drawBitmap(aBitmap, aJSrcRect, aJDestRectf, apaint);
但我没有很好的抗锯齿图像(它抗锯齿,但不是很好)。这是一张显示我的问题的图片
我可以做些什么来提高 android 下的抗锯齿质量?
最佳答案
为了抗锯齿效果,你可以尝试创建一个这样的Paint:
Paint paint= new Paint();
paint.setFlags(Paint.ANTI_ALIAS_FLAG);
paint.setAntiAlias(true);
paint.setFilterBitmap(true);
最后在 Canvas 上涂抹颜料:
canvas.drawBitmap(mBitmap, 0.f, 0.f, paint)
关于android - 如何使用抗锯齿有效地调整图像大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46239959/