Android Question CreateScaledBitmap filter

LucaMs

Expert
Licensed User
Longtime User
This function requires a boolean as Filter:
B4X:
Sub CreateScaledBitmap(Original As Bitmap, Width As Int, Height As Int, Filter As Boolean) As Bitmap
  Dim r As Reflector
  Dim b As Bitmap
  b = r.RunStaticMethod("android.graphics.Bitmap", "createScaledBitmap", _
      Array As Object(Original, Width, Height, Filter), _
      Array As String("android.graphics.Bitmap", "java.lang.int", "java.lang.int", "java.lang.boolean"))
  Return b
End Sub

I found this:
http://stackoverflow.com/questions/2895065/what-does-the-filter-parameter-to-createscaledbitmap-do

and, from a link in that page:
  • SCALE_REPLICATE: Specific hint that provides higher performance, but lower-quality, "blocky" results.
  • SCALE_FAST: General hint meaning "I prefer speed over quality, but I'm not picky about the exact algorithm;" in Sun's current implementation (JDK 6 at the time of this writing) this is synonymous with SCALE_REPLICATE.
  • SCALE_AREA_AVERAGING: Specific hint that is slower, but provides higher-quality, "filtered" results.
  • SCALE_SMOOTH: General hint meaning "I prefer quality over speed, but I'm not picky about the exact algorithm;" in Sun's current implementation, this is generally synonymous withSCALE_AREA_AVERAGING. (As with the other hints, this mapping is implementation-dependent and subject to change; read thePerformance Notes section below for more on how this mapping could change in an upcoming release of Sun's JDK implementation.)
  • SCALE_DEFAULT: General hint meaning "I don't care, just pick something for me;" in Sun's current implementation, this is synonymous with SCALE_FAST.

What should I pass?


P.S.
Well, downsizing I get better quality setting Filter to True.

[upsizing too]
 
Last edited:

eurojam

Well-Known Member
Licensed User
Longtime User
I would pass TRUE or FALSE :D
In my understanding the filteflag means when False, only a downsampling will happen and when passing true, the result will be more smooth...best will be to try it with and without and compare the results.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I would pass TRUE or FALSE :D
In my understanding the filteflag means when False, only a downsampling will happen and when passing true, the result will be more smooth...best will be to try it with and without and compare the results.
Done.
It returns better results if Filter is set to True (but I suppose you should set some filter type).
 
Upvote 0
Top