Gallery2: SeeStraight feature.

Introducing See Straight feature.

Change-Id: I1074696cbf26f18b23181a968ec4e3130d8e1f80
CRs-Fixed: 967813
diff --git a/res/drawable/seestraight.xml b/res/drawable/seestraight.xml
new file mode 100644
index 0000000..562ccde
--- /dev/null
+++ b/res/drawable/seestraight.xml
@@ -0,0 +1,62 @@
+<!--
+  Copyright (c) 2016, The Linux Foundation. All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions are
+  met:
+      * Redistributions of source code must retain the above copyright
+        notice, this list of conditions and the following disclaimer.
+      * Redistributions in binary form must reproduce the above
+        copyright notice, this list of conditions and the following
+        disclaimer in the documentation and/or other materials provided
+        with the distribution.
+      * Neither the name of The Linux Foundation nor the names of its
+        contributors may be used to endorse or promote products derived
+        from this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+  ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+  IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="32dp"
+    android:height="32dp"
+    android:viewportWidth="32"
+    android:viewportHeight="32">
+
+    <path
+        android:fillColor="#FFFFFF"
+        android:pathData="M 7.2 23.3 L 5.5 23.3 L 5.5 7.1 L 13.3 4.8 L 14.1 4.8 L 21.7 7.1 L 21.7 11.9 L 20 11.9 L 20 8.3 L 13.7 6.5 L 13.4 6.5 L 7.2 8.3 Z" />
+    <path
+        android:fillColor="#FFFFFF"
+        android:pathData="M 8.6 7 L 8 7 L 8 5.3 L 13.5 3.5 L 19.1 5.3 L 19.1 7 L 18.6 7 L 18.6 5.7 L 13.5 4.1 L 8.6 5.7 Z" />
+    <path
+        android:fillColor="#FFFFFF"
+        android:pathData="M 13.4 3.8 H 13.7 V 5.6 H 13.4 V 3.8 Z" />
+    <path
+        android:fillColor="#FFFFFF"
+        android:pathData="M 13 23.3 L 12.7 23.3 L 12.7 8.4 L 6.5 10.2 L 6.5 9.9 L 13 8.1 Z" />
+    <path
+        android:fillColor="#FFFFFF"
+        android:pathData="M 14.4 23.3 L 14.1 23.3 L 14.1 8 L 20.7 9.8 L 20.6 10.1 L 14.4 8.3 Z" />
+    <path
+        android:fillColor="#FFFFFF"
+        android:pathData="M29.8,27h-1.7v-1.4h1.7V27z M26.3,27h-1.8v-1.4h1.8V27z M22.6,27h-1.8v-1.4h1.8V27z
+M18.9,27h-1.8v-1.4 h1.8V27z M15.3,27h-1.8v-1.4h1.8V27z M11.6,27H9.8v-1.4h1.8V27z
+M8,27H6.2v-1.4H8V27z M4.3,27H2.5v-1.4h1.8V27z" />
+    <path
+        android:fillColor="#FFFFFF"
+        android:pathData="M 26.7 23.3 L 25 23.3 L 25 13.4 L 22.3 12.3 L 19.6 13.4 L 19.6 23.3 L 17.8 23.3 L 17.8 12.2 L 22 10.6 L 22.6 10.6 L 26.7 12.2 Z" />
+    <path
+        android:fillColor="#FFFFFF"
+        android:pathData="M 22.2 11.6 H 22.5 V 23.3 H 22.2 V 11.6 Z" />
+</vector>
diff --git a/res/layout/filtershow_main_panel.xml b/res/layout/filtershow_main_panel.xml
index 753ed30..ee9990d 100644
--- a/res/layout/filtershow_main_panel.xml
+++ b/res/layout/filtershow_main_panel.xml
@@ -130,6 +130,16 @@
                 android:padding="2dip"
                 android:scaleType="centerInside"
                 android:src="@drawable/hazebuster"/>
+
+            <ImageButton
+                android:id="@+id/seeStraightButton"
+                android:layout_width="@dimen/thumbnail_size"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:background="@drawable/filtershow_button_background"
+                android:padding="2dip"
+                android:scaleType="centerInside"
+                android:src="@drawable/seestraight"/>
         </LinearLayout>
 
         <LinearLayout
@@ -219,6 +229,16 @@
                 android:gravity="center"
                 android:textColor="#ffffff"
                 android:textSize="@dimen/edit_main_font" />
+
+            <TextView
+                android:id="@+id/tvSeeStraight"
+                android:layout_width="@dimen/thumbnail_size"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:text="@string/seeStraight"
+                android:gravity="center"
+                android:textColor="#ffffff"
+                android:textSize="@dimen/edit_main_font" />
         </LinearLayout>
     </com.android.gallery3d.filtershow.CenteredLinearLayout>
 </LinearLayout>
diff --git a/res/values/filtershow_ids.xml b/res/values/filtershow_ids.xml
index 70b3e72..0cd7082 100644
--- a/res/values/filtershow_ids.xml
+++ b/res/values/filtershow_ids.xml
@@ -56,4 +56,5 @@
     <item type="id" name="editorDualCamFusion" />
     <item type="id" name="trueScannerEditor" />
     <item type="id" name="hazeBusterEditor" />
+    <item type="id" name="seeStraightEditor" />
 </resources>
diff --git a/res/values/filtershow_strings.xml b/res/values/filtershow_strings.xml
index 2a7b505..01f667e 100644
--- a/res/values/filtershow_strings.xml
+++ b/res/values/filtershow_strings.xml
@@ -136,6 +136,8 @@
     <string name="trueScanner">True Scanner</string>
     <!--  HazeBuster button -->
     <string name="hazeBuster">Haze Buster</string>
+    <!--  SeeStraight button -->
+    <string name="seeStraight">See Straight</string>
     <!--  Label for the image exposure (brightness) filter button [CHAR LIMIT=10] -->
     <string name="exposure" msgid="1229093066434614811">Exposure</string>
     <!--  Label for the image sharpness (clarity, distinctness) filter button [CHAR LIMIT=10] -->
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0873546..7bf2876 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1190,4 +1190,5 @@
     <string name="truescanner_normal">Normal</string>
     <string name="truescanner_white">WhiteBoard</string>
     <string name="hazebuster_acts">Haze Buster</string>
+    <string name="seestraight_acts">See Straight</string>
 </resources>
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
index 810132c..a0c9893 100644
--- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java
+++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
@@ -185,6 +185,7 @@
     private CategoryAdapter mCategoryFiltersAdapter = null;
     private CategoryAdapter mCategoryTrueScannerAdapter = null;
     private CategoryAdapter mCategoryHazeBusterAdapter = null;
+    private CategoryAdapter mCategorySeeStraightAdapter = null;
     private CategoryAdapter mCategoryVersionsAdapter = null;
     private CategoryAdapter mCategoryMakeupAdapter = null;
     private CategoryAdapter mCategoryDualCamAdapter = null;
@@ -577,6 +578,7 @@
         fillEffects();
         fillTrueScanner();
         fillHazeBuster();
+        fillSeeStraight();
         fillVersions();
         fillMakeup();
         fillDualCamera();
@@ -732,6 +734,21 @@
         }
     }
 
+    private void fillSeeStraight() {
+        FiltersManager filtersManager = FiltersManager.getManager();
+        ArrayList<FilterRepresentation> hazeBusterRepresentations = filtersManager.getSeeStraight();
+        if (mCategorySeeStraightAdapter != null) {
+            mCategorySeeStraightAdapter.clear();
+        }
+        mCategorySeeStraightAdapter = new CategoryAdapter(this);
+        for (FilterRepresentation representation : hazeBusterRepresentations) {
+            if (representation.getTextId() != 0) {
+                representation.setName(getString(representation.getTextId()));
+            }
+            mCategorySeeStraightAdapter.add(new Action(this, representation));
+        }
+    }
+
     private void fillTools() {
         FiltersManager filtersManager = FiltersManager.getManager();
         ArrayList<FilterRepresentation> filtersRepresentations = filtersManager.getTools();
@@ -878,6 +895,10 @@
         return mCategoryHazeBusterAdapter;
     }
 
+    public CategoryAdapter getCategorySeeStraightAdapter() {
+        return mCategorySeeStraightAdapter;
+    }
+
     public CategoryAdapter getCategoryVersionsAdapter() {
         return mCategoryVersionsAdapter;
     }
diff --git a/src/com/android/gallery3d/filtershow/category/CategoryAdapter.java b/src/com/android/gallery3d/filtershow/category/CategoryAdapter.java
index 2724f23..d5fafee 100644
--- a/src/com/android/gallery3d/filtershow/category/CategoryAdapter.java
+++ b/src/com/android/gallery3d/filtershow/category/CategoryAdapter.java
@@ -97,6 +97,10 @@
             mSelectedPosition = 0;
         }
 
+        if (category == MainPanel.SEESTRAIGHT) {
+            mSelectedPosition = 0;
+        }
+
         if (category == MainPanel.VERSIONS) {
             mAddButtonText = getContext().getString(R.string.filtershow_add_button_versions);
         }
diff --git a/src/com/android/gallery3d/filtershow/category/CategoryPanel.java b/src/com/android/gallery3d/filtershow/category/CategoryPanel.java
index c822d23..096e65f 100644
--- a/src/com/android/gallery3d/filtershow/category/CategoryPanel.java
+++ b/src/com/android/gallery3d/filtershow/category/CategoryPanel.java
@@ -103,6 +103,13 @@
                 }
                 break;
             }
+            case MainPanel.SEESTRAIGHT: {
+                mAdapter = activity.getCategorySeeStraightAdapter();
+                if (mAdapter != null) {
+                    mAdapter.initializeSelection(MainPanel.SEESTRAIGHT);
+                }
+                break;
+            }
             case MainPanel.VERSIONS: {
                 mAdapter = activity.getCategoryVersionsAdapter();
                 if (mAdapter != null) {
diff --git a/src/com/android/gallery3d/filtershow/category/MainPanel.java b/src/com/android/gallery3d/filtershow/category/MainPanel.java
index cbff421..c5f9c6e 100644
--- a/src/com/android/gallery3d/filtershow/category/MainPanel.java
+++ b/src/com/android/gallery3d/filtershow/category/MainPanel.java
@@ -31,6 +31,7 @@
 import com.android.gallery3d.R;
 import com.android.gallery3d.filtershow.FilterShowActivity;
 import com.android.gallery3d.filtershow.filters.HazeBusterActs;
+import com.android.gallery3d.filtershow.filters.SeeStraightActs;
 import com.android.gallery3d.filtershow.filters.SimpleMakeupImageFilter;
 import com.android.gallery3d.filtershow.filters.TrueScannerActs;
 import com.android.gallery3d.filtershow.imageshow.MasterImage;
@@ -55,6 +56,7 @@
     private View mBottomView;
     private ImageButton trueScannerButton;
     private ImageButton hazeBusterButton;
+    private ImageButton seeStraightButton;
 
     public static final String FRAGMENT_TAG = "MainPanel";
     public static final String EDITOR_TAG = "coming-from-editor-panel";
@@ -67,6 +69,7 @@
     public static final int VERSIONS = 6;
     public static final int TRUESCANNER = 7;
     public static final int HAZEBUSTER = 8;
+    public static final int SEESTRAIGHT = 9;
 
     private int mCurrentSelected = -1;
     private int mPreviousToggleVersions = -1;
@@ -110,6 +113,9 @@
             case HAZEBUSTER: {
                 break;
             }
+            case SEESTRAIGHT: {
+                break;
+            }
         }
     }
 
@@ -175,6 +181,13 @@
             hazeBusterButton.setVisibility(View.GONE);
         }
 
+        seeStraightButton = (ImageButton) mMainView.findViewById(R.id.seeStraightButton);
+        TextView seeStraightTv = (TextView) mMainView.findViewById(R.id.tvSeeStraight);
+        if(!SeeStraightActs.isSeeStraightEnabled()) {
+            seeStraightButton.setVisibility(View.GONE);
+            seeStraightTv.setVisibility(View.GONE);
+        }
+
         looksButton.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
@@ -222,6 +235,13 @@
             }
         });
 
+        seeStraightButton.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                showPanel(SEESTRAIGHT);
+            }
+        });
+
         FilterShowActivity activity = (FilterShowActivity) getActivity();
         //showImageStatePanel(activity.isShowingImageStatePanel());
         if (showPanel) {
@@ -349,6 +369,16 @@
         selection(mCurrentSelected, true);
     }
 
+    public void loadCategorySeeStraightPanel() {
+        boolean fromRight = isRightAnimation(SEESTRAIGHT);
+        selection(mCurrentSelected, false);
+        CategoryPanel categoryPanel = new CategoryPanel();
+        categoryPanel.setAdapter(SEESTRAIGHT);
+        setCategoryFragment(categoryPanel, fromRight);
+        mCurrentSelected = SEESTRAIGHT;
+        selection(mCurrentSelected, true);
+    }
+
     public void loadCategoryFiltersPanel() {
         /*if (mCurrentSelected == FILTERS) {
             return;
@@ -428,6 +458,10 @@
                 loadCategoryHazeBusterPanel();
                 break;
             }
+            case SEESTRAIGHT: {
+                loadCategorySeeStraightPanel();
+                break;
+            }
             case VERSIONS: {
                 loadCategoryVersionsPanel();
                 break;
diff --git a/src/com/android/gallery3d/filtershow/editors/SeeStraightEditor.java b/src/com/android/gallery3d/filtershow/editors/SeeStraightEditor.java
new file mode 100644
index 0000000..89c22f4
--- /dev/null
+++ b/src/com/android/gallery3d/filtershow/editors/SeeStraightEditor.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2016, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials provided
+ *    with the distribution.
+ *  * Neither the name of The Linux Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.android.gallery3d.filtershow.editors;
+
+import android.content.Context;
+import android.widget.FrameLayout;
+
+import com.android.gallery3d.R;
+import com.android.gallery3d.filtershow.filters.SeeStraightActs;
+import com.android.gallery3d.filtershow.imageshow.ImageShow;
+
+public class SeeStraightEditor extends Editor {
+    public final static int ID = R.id.seeStraightEditor;
+    private final String LOGTAG = "SeeStraightEditor";
+
+    public SeeStraightEditor() {
+        super(ID);
+    }
+
+    protected SeeStraightEditor(int id) {
+        super(id);
+    }
+
+    public boolean useUtilityPanel() {
+        return true;
+    }
+
+    @Override
+    public void createEditor(Context context, FrameLayout frameLayout) {
+        super.createEditor(context, frameLayout);
+        mView = mImageShow = new ImageShow(context);
+    }
+
+    @Override
+    public void finalApplyCalled() {
+        super.finalApplyCalled();
+    }
+
+    @Override
+    public boolean showsSeekBar() {
+        return false;
+    }
+
+}
diff --git a/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java b/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java
index df3e5c2..440c66b 100644
--- a/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java
+++ b/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java
@@ -41,6 +41,7 @@
     protected ArrayList<FilterRepresentation> mDualCam = new ArrayList<FilterRepresentation>();
     protected ArrayList<FilterRepresentation> mTrueScanner = new ArrayList<FilterRepresentation>();
     protected ArrayList<FilterRepresentation> mHazeBuster = new ArrayList<FilterRepresentation>();
+    protected ArrayList<FilterRepresentation> mSeeStraight = new ArrayList<FilterRepresentation>();
     private static int mImageBorderSize = 4; // in percent
 
     protected void init() {
@@ -50,6 +51,7 @@
         addFilterClasses(filters);
         addTrueScannerClasses(filters);
         addHazeBusterClasses(filters);
+        addSeeStraightClasses(filters);
         for (Class filterClass : filters) {
             try {
                 Object filterInstance = filterClass.newInstance();
@@ -168,6 +170,10 @@
         filters.add(HazeBusterActs.class);
     }
 
+    protected void addSeeStraightClasses(Vector<Class> filters) {
+        filters.add(SeeStraightActs.class);
+    }
+
     public ArrayList<FilterRepresentation> getLooks() {
         return mLooks;
     }
@@ -197,6 +203,9 @@
     public ArrayList<FilterRepresentation> getHazeBuster() {
         return mHazeBuster;
     }
+    public ArrayList<FilterRepresentation> getSeeStraight() {
+        return mSeeStraight;
+    }
 
     public void addBorders(Context context) {
         // Do not localize
@@ -363,6 +372,10 @@
         mHazeBuster.add(getRepresentation(HazeBusterActs.class));
     }
 
+    public void addSeeStraight() {
+        mSeeStraight.add(getRepresentation(SeeStraightActs.class));
+    }
+
     public void addTools(Context context) {
 
         int[] textId = {
diff --git a/src/com/android/gallery3d/filtershow/filters/SeeStraightActs.java b/src/com/android/gallery3d/filtershow/filters/SeeStraightActs.java
new file mode 100644
index 0000000..e948959
--- /dev/null
+++ b/src/com/android/gallery3d/filtershow/filters/SeeStraightActs.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2016, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials provided
+ *    with the distribution.
+ *  * Neither the name of The Linux Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.android.gallery3d.filtershow.filters;
+
+import android.graphics.Bitmap;
+import android.util.Log;
+
+import com.android.gallery3d.R;
+import com.android.gallery3d.filtershow.editors.SeeStraightEditor;
+
+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 boolean DEBUG = true;
+    private static boolean isSeeStraightEnabled = true;
+
+    private void printDebug(String str) {
+        if(DEBUG)
+            android.util.Log.d("SeeStraight", str);
+    }
+
+    public static boolean isSeeStraightEnabled() {
+        return isSeeStraightEnabled;
+    }
+
+    public SeeStraightActs() {
+        mName = "SeeStraightActs";
+    }
+
+    public FilterRepresentation getDefaultRepresentation() {
+        FilterBasicRepresentation representation = (FilterBasicRepresentation) super.getDefaultRepresentation();
+        representation.setName("SeeStraight");
+        representation.setSerializationName(SERIALIZATION_NAME);
+        representation.setFilterClass(SeeStraightActs.class);
+        representation.setTextId(R.string.seestraight_acts);
+        representation.setMinimum(0);
+        representation.setMaximum(10);
+        representation.setValue(0);
+        representation.setDefaultValue(0);
+        representation.setSupportsPartialRendering(false);
+        representation.setEditorId(SeeStraightEditor.ID);
+
+        return representation;
+    }
+
+    private native int[] processImage(int width, int height, Bitmap srcBitmap, Bitmap dstBitmap);
+
+    @Override
+    public Bitmap apply(Bitmap bitmap, float not_use, int quality) {
+        if(bitmap == null)
+            return null;
+        int width = bitmap.getWidth();
+        int height = bitmap.getHeight();
+
+        if(width <= MIN_WIDTH && height <= MIN_HEIGHT)
+            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;
+        }
+        dstBitmap = Bitmap.createBitmap(dstBitmap, outputRoi[0], outputRoi[1], outputRoi[2], outputRoi[3]);
+        return dstBitmap;
+    }
+
+    static {
+        try {
+            System.loadLibrary("jni_seestraight");
+            isSeeStraightEnabled = true;
+        } catch(UnsatisfiedLinkError e) {
+            isSeeStraightEnabled = false;
+        }
+    }
+}
diff --git a/src/com/android/gallery3d/filtershow/pipeline/ProcessingService.java b/src/com/android/gallery3d/filtershow/pipeline/ProcessingService.java
index 9c0a4b5..a79339e 100644
--- a/src/com/android/gallery3d/filtershow/pipeline/ProcessingService.java
+++ b/src/com/android/gallery3d/filtershow/pipeline/ProcessingService.java
@@ -311,6 +311,7 @@
         filtersManager.addMakeups(this);
         filtersManager.addTrueScanner();
         filtersManager.addHazeBuster();
+        filtersManager.addSeeStraight();
 
         FiltersManager highresFiltersManager = FiltersManager.getHighresManager();
         highresFiltersManager.addLooks(this);
@@ -321,6 +322,7 @@
 //        highresFiltersManager.addMakeups(this);
         highresFiltersManager.addTrueScanner();
         highresFiltersManager.addHazeBuster();
+        highresFiltersManager.addSeeStraight();
     }
 
     private void tearDownPipeline() {
diff --git a/src_pd/com/android/gallery3d/filtershow/editors/EditorManager.java b/src_pd/com/android/gallery3d/filtershow/editors/EditorManager.java
index bdac4a9..2d30d8f 100644
--- a/src_pd/com/android/gallery3d/filtershow/editors/EditorManager.java
+++ b/src_pd/com/android/gallery3d/filtershow/editors/EditorManager.java
@@ -41,5 +41,6 @@
         editorPlaceHolder.addEditor(new EditorDualCamSketch());
         editorPlaceHolder.addEditor(new TrueScannerEditor());
         editorPlaceHolder.addEditor(new HazeBusterEditor());
+        editorPlaceHolder.addEditor(new SeeStraightEditor());
     }
 }