什么是过滤器参数createScaledBitmap办? [英] What does the filter parameter to createScaledBitmap do?

查看:281
本文介绍了什么是过滤器参数createScaledBitmap办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

的声明 android.graphics.Bitmap.createScaledBitmap

public static Bitmap createScaledBitmap
  (Bitmap src, int dstWidth, int dstHeight, boolean filter)

不过,文件没有解释任何参数。他们都是pretty的明显的,除了布尔过滤器。有谁知道它做什么?

However, the documentation doesn't explain any of the parameters. All of them are pretty obvious except for boolean filter. Does anyone know what it does?

推荐答案

通过Skia的源 - code快速挖表明(至少是默认)过滤器标志导致它做一个简单的双线性插值。检查维基百科或您喜欢的图形参考,看看有什么预期的后果。传统上,你想升迁图像时,与裁员图像时的区域平均做双线性或双三次插值。我得到的IM pression(虽然我很高兴得到纠正)的安卓/ Skia的进行简单的二次抽样无滤波裁员的时候,所以你很可能从裁员时,过滤甚至获得更好的结果。 (有获取高品质的插值裁员,涉及做了一系列的50%,规模减少的另一种方法,参见<一href="http://today.java.net/pub/a/today/2007/04/03/perils-of-image-getscaledinstance.html">http://today.java.net/pub/a/today/2007/04/03/perils-of-image-getscaledinstance.html了解详细信息。)

A quick dig through the SKIA source-code indicates that (at least by default) the FILTER flag causes it to do a straightforward bilinear interpolation. Check Wikipedia or your favorite graphics reference to see what the expected consequences are. Traditionally, you want to do bilinear or bicubic interpolation when upsizing images, and area averaging when downsizing images. I get the impression (though I'm glad to be corrected) that Android/Skia does simple subsampling when downsizing without filtering, so you are likely to get better results from filtering even when downsizing. (There's an alternate method for getting high quality downsizing with interpolation, involving doing a series of 50% scale reductions. See http://today.java.net/pub/a/today/2007/04/03/perils-of-image-getscaledinstance.html for details.)

这篇关于什么是过滤器参数createScaledBitmap办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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