Android的:转变图像和插值算法 [英] Android: transforming images and interpolation algorithm

查看:1060
本文介绍了Android的:转变图像和插值算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前通过绘制它们使用矩阵在画布上放置超过对方的图像。
问题是:旋转和缩放后,我结束了脏/粗糙的边缘。看起来是这样的:
http://i.stack.imgur.com/5pPQJ.png

I am currently placing images over each other by drawing them on a canvas using a matrix. The problem is: after rotating and scaling I end up with dirty/rough edges. Looks like this: http://i.stack.imgur.com/5pPQJ.png

问题是不是该图像是低分辨率的,我的理论是,它是关系到Android的绘图引擎的插值算法。

The problem is NOT that the image is low resolution, my theory is that it is related to the interpolation algorithm of the drawing engine in android.

谁能给我在这里一些建议吗?

Can anyone give me some advice here?

推荐答案

Android使用近邻插值通过默认就是为什么你越来越像素化图像。您可以强制其使用双线性插值使用 FILTER_BITMAP_FLAG 。所有以下的变种居然做同样的:

Android uses nearest-neighbor interpolation by default that why you are getting pixelated image. You can force it to use bilinear interpolation using FILTER_BITMAP_FLAG. All of the followings variants actually do the same:

final Paint paint = new Paint(Paint.FILTER_BITMAP_FLAG);

paint.setFlags(paint.getFlags() | Paint.FILTER_BITMAP_FLAG);
paint.setFilterBitmap(true);

这篇关于Android的:转变图像和插值算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆