What does the filter parameter to createScaledBitmap do?

前端 未结 4 1165
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-29 17:13

The declaration of android.graphics.Bitmap.createScaledBitmap is

public static Bitmap createScaledBitmap
  (Bitmap src, int dstWidth, int dstHei         


        
4条回答
  •  忘掉有多难
    2020-11-29 17:46

    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.)

提交回复
热议问题