diff options
| -rwxr-xr-x | res/values/strings.xml | 2 | ||||
| -rw-r--r-- | src/com/android/gallery3d/filtershow/filters/SeeStraightActs.java | 19 |
2 files changed, 19 insertions, 2 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index 516c5be99..7d33f8a15 100755 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1191,4 +1191,6 @@ CHAR LIMIT = NONE] --> <string name="truescanner_white">WhiteBoard</string> <string name="hazebuster_acts">Haze Buster</string> <string name="seestraight_acts">See Straight</string> + <string name="seestraight_input_image_is_small">Input image is too small to process.</string> + <string name="seestraight_process_fail">Couldn\'t process the image.</string> </resources> diff --git a/src/com/android/gallery3d/filtershow/filters/SeeStraightActs.java b/src/com/android/gallery3d/filtershow/filters/SeeStraightActs.java index e9489595e..7ecae02cf 100644 --- a/src/com/android/gallery3d/filtershow/filters/SeeStraightActs.java +++ b/src/com/android/gallery3d/filtershow/filters/SeeStraightActs.java @@ -31,6 +31,7 @@ package com.android.gallery3d.filtershow.filters; import android.graphics.Bitmap; import android.util.Log; +import android.widget.Toast; import com.android.gallery3d.R; import com.android.gallery3d.filtershow.editors.SeeStraightEditor; @@ -39,6 +40,7 @@ public class SeeStraightActs extends SimpleImageFilter { public static final String SERIALIZATION_NAME = "SeeStraightActs"; private static final int MIN_WIDTH = 512; private static final int MIN_HEIGHT = 512; + private static final int MIN_INPUT_REQUIREMENT = 640; private static final boolean DEBUG = true; private static boolean isSeeStraightEnabled = true; @@ -83,11 +85,24 @@ public class SeeStraightActs extends SimpleImageFilter { if(width <= MIN_WIDTH && height <= MIN_HEIGHT) return bitmap; + if(width <= MIN_INPUT_REQUIREMENT || height <= MIN_INPUT_REQUIREMENT) { + sActivity.runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(sActivity, sActivity.getResources().getString(R.string.seestraight_input_image_is_small), Toast.LENGTH_SHORT).show(); + } + }); + return bitmap; + } + Bitmap dstBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); int[] outputRoi = processImage(width, height, bitmap, dstBitmap); if(outputRoi == null) { - printDebug("See Straight filter is not effective"); - return dstBitmap; + sActivity.runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(sActivity, sActivity.getResources().getString(R.string.seestraight_process_fail), Toast.LENGTH_SHORT).show(); + } + }); + return bitmap; } dstBitmap = Bitmap.createBitmap(dstBitmap, outputRoi[0], outputRoi[1], outputRoi[2], outputRoi[3]); return dstBitmap; |
