OSDN Git Service

parameter change according to api
authorRuei-sung Lin <rslin@google.com>
Thu, 15 Sep 2011 09:26:58 +0000 (17:26 +0800)
committerRuei-sung Lin <rslin@google.com>
Thu, 22 Sep 2011 06:43:58 +0000 (14:43 +0800)
Change-Id: I189cca762b80ba45b5322121b57e8c13b82a4811

mca/filterpacks/imageproc/java/VignetteFilter.java

index cc84ab5..2d78fff 100644 (file)
@@ -31,7 +31,7 @@ import android.filterfw.format.ImageFormat;
 public class VignetteFilter extends Filter {
 
     @GenerateFieldPort(name = "scale", hasDefault = true)
-    private float mRange = 0f;
+    private float mScale = 0f;
 
     @GenerateFieldPort(name = "tile_size", hasDefault = true)
     private int mTileSize = 640;
@@ -107,10 +107,12 @@ public class VignetteFilter extends Filter {
     }
 
     private void updateParameters() {
-        mProgram.setHostValue("range", mRange);
+        // The 'range' is between 1.3 to 0.6. When scale is zero then range is 1.3
+        // which means no vignette at all because the luminousity difference is
+        // less than 1/256 and will cause nothing.
+        mProgram.setHostValue("range", 1.30f - (float) Math.sqrt(mScale) * 0.7f);
     }
 
-
     @Override
     public void fieldPortValueUpdated(String name, FilterContext context) {
         if (mProgram != null) {