summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Hoford <hoford@google.com>2013-02-13 15:52:31 -0800
committerJohn Hoford <hoford@google.com>2013-02-13 17:38:32 -0800
commit498d78073c24f25055a2dc4943cdd0a42f85702c (patch)
tree7b771875ad41e351d94487d3d9c7ffc767f3c1af /src
parent147af26e86b7fa8f2d195651e3786c0102346702 (diff)
downloadandroid_packages_apps_Snap-498d78073c24f25055a2dc4943cdd0a42f85702c.tar.gz
android_packages_apps_Snap-498d78073c24f25055a2dc4943cdd0a42f85702c.tar.bz2
android_packages_apps_Snap-498d78073c24f25055a2dc4943cdd0a42f85702c.zip
get redeye working again
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/filtershow/editors/EditorRedEye.java2
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterRedEyeRepresentation.java11
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilter.java5
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterGeometry.java5
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterNegative.java5
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterRS.java2
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterRedEye.java15
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterStraighten.java5
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterWBalance.java5
-rw-r--r--src/com/android/gallery3d/filtershow/imageshow/ImageRedEye.java2
10 files changed, 48 insertions, 9 deletions
diff --git a/src/com/android/gallery3d/filtershow/editors/EditorRedEye.java b/src/com/android/gallery3d/filtershow/editors/EditorRedEye.java
index 271f16535..c37102b37 100644
--- a/src/com/android/gallery3d/filtershow/editors/EditorRedEye.java
+++ b/src/com/android/gallery3d/filtershow/editors/EditorRedEye.java
@@ -51,10 +51,10 @@ public class EditorRedEye extends Editor {
@Override
public void reflectCurrentFilter() {
super.reflectCurrentFilter();
-
FilterRepresentation rep = getLocalRepresentation();
if (rep != null && getLocalRepresentation() instanceof FilterRedEyeRepresentation) {
FilterRedEyeRepresentation redEyeRep = (FilterRedEyeRepresentation) rep;
+
mImageRedEyes.setRepresentation(redEyeRep);
}
}
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterRedEyeRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterRedEyeRepresentation.java
index 329f5204e..7779211df 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterRedEyeRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterRedEyeRepresentation.java
@@ -65,6 +65,17 @@ public class FilterRedEyeRepresentation extends FilterRepresentation {
this.mCandidates.add(c);
}
+ @Override
+ public void useParametersFrom(FilterRepresentation a) {
+ if (a instanceof FilterRedEyeRepresentation) {
+ FilterRedEyeRepresentation representation = (FilterRedEyeRepresentation) a;
+ mCandidates.clear();
+ for (RedEyeCandidate redEyeCandidate : representation.mCandidates) {
+ mCandidates.add(redEyeCandidate);
+ }
+ }
+ }
+
public void removeCandidate(RedEyeCandidate c) {
this.mCandidates.remove(c);
}
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilter.java b/src/com/android/gallery3d/filtershow/filters/ImageFilter.java
index 256f5d671..7c5a75232 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilter.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilter.java
@@ -22,7 +22,7 @@ import com.android.gallery3d.R;
import com.android.gallery3d.filtershow.editors.BasicEditor;
import com.android.gallery3d.filtershow.presets.ImagePreset;
-public class ImageFilter implements Cloneable {
+public abstract class ImageFilter implements Cloneable {
private ImagePreset mImagePreset;
@@ -58,8 +58,7 @@ public class ImageFilter implements Cloneable {
mImagePreset = imagePreset;
}
- public void useRepresentation(FilterRepresentation representation) {
- }
+ public abstract void useRepresentation(FilterRepresentation representation);
native protected void nativeApplyGradientFilter(Bitmap bitmap, int w, int h,
int[] redGradient, int[] greenGradient, int[] blueGradient);
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterGeometry.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterGeometry.java
index 1380c528d..329ca81b9 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterGeometry.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterGeometry.java
@@ -67,6 +67,11 @@ public class ImageFilterGeometry extends ImageFilter {
Bitmap dst, int dstWidth, int dstHeight, float straightenAngle);
@Override
+ public void useRepresentation(FilterRepresentation representation) {
+
+ }
+
+ @Override
public Bitmap apply(Bitmap bitmap, float scaleFactor, int quality) {
// TODO: implement bilinear or bicubic here... for now, just use
// canvas to do a simple implementation...
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterNegative.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterNegative.java
index 34cd052eb..841c5c913 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterNegative.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterNegative.java
@@ -25,6 +25,11 @@ public class ImageFilterNegative extends ImageFilter {
native protected void nativeApplyFilter(Bitmap bitmap, int w, int h);
@Override
+ public void useRepresentation(FilterRepresentation representation) {
+
+ }
+
+ @Override
public Bitmap apply(Bitmap bitmap, float scaleFactor, int quality) {
int w = bitmap.getWidth();
int h = bitmap.getHeight();
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterRS.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterRS.java
index c741a4887..d5297904d 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterRS.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterRS.java
@@ -21,7 +21,7 @@ import android.graphics.Bitmap;
import android.support.v8.renderscript.*;
import android.util.Log;
-public class ImageFilterRS extends ImageFilter {
+public abstract class ImageFilterRS extends ImageFilter {
private final String LOGTAG = "ImageFilterRS";
private static RenderScript mRS = null;
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterRedEye.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterRedEye.java
index 5f5314946..42587c06f 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterRedEye.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterRedEye.java
@@ -17,10 +17,13 @@
package com.android.gallery3d.filtershow.filters;
import android.graphics.Bitmap;
+import android.graphics.Canvas;
import android.graphics.Matrix;
+import android.graphics.Paint;
+import android.graphics.Rect;
import android.graphics.RectF;
+import android.util.Log;
-import com.android.gallery3d.R;
import com.android.gallery3d.filtershow.imageshow.GeometryMetadata;
import java.util.Vector;
@@ -62,12 +65,17 @@ public class ImageFilterRedEye extends ImageFilter {
native protected void nativeApplyFilter(Bitmap bitmap, int w, int h, short[] matrix);
@Override
+ public void useRepresentation(FilterRepresentation representation) {
+ FilterRedEyeRepresentation parameters = (FilterRedEyeRepresentation) representation;
+ mParameters = parameters;
+ }
+
+ @Override
public Bitmap apply(Bitmap bitmap, float scaleFactor, int quality) {
int w = bitmap.getWidth();
int h = bitmap.getHeight();
short[] rect = new short[4];
int size = mParameters.getNumberOfCandidates();
-
for (int i = 0; i < size; i++) {
RectF r = new RectF(mParameters.getCandidate(i).mRect);
GeometryMetadata geo = getImagePreset().mGeoData;
@@ -100,13 +108,14 @@ public class ImageFilterRedEye extends ImageFilter {
if (r.bottom > h) {
r.bottom = h;
}
+
rect[0] = (short) r.left;
rect[1] = (short) r.top;
rect[2] = (short) r.width();
rect[3] = (short) r.height();
+
nativeApplyFilter(bitmap, w, h, rect);
}
-
return bitmap;
}
}
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterStraighten.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterStraighten.java
index 92bde992d..a3bb6f980 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterStraighten.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterStraighten.java
@@ -53,6 +53,11 @@ public class ImageFilterStraighten extends ImageFilter {
}
@Override
+ public void useRepresentation(FilterRepresentation representation) {
+
+ }
+
+ @Override
public Bitmap apply(Bitmap bitmap, float scaleFactor, int quality) {
// TODO: implement bilinear or bicubic here... for now, just use
// canvas to do a simple implementation...
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterWBalance.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterWBalance.java
index 7f21fea30..2f4852306 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterWBalance.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterWBalance.java
@@ -40,6 +40,11 @@ public class ImageFilterWBalance extends ImageFilter {
return representation;
}
+ @Override
+ public void useRepresentation(FilterRepresentation representation) {
+
+ }
+
native protected void nativeApplyFilter(Bitmap bitmap, int w, int h, int locX, int locY);
@Override
diff --git a/src/com/android/gallery3d/filtershow/imageshow/ImageRedEye.java b/src/com/android/gallery3d/filtershow/imageshow/ImageRedEye.java
index 2db9227b9..ba3dcdd1d 100644
--- a/src/com/android/gallery3d/filtershow/imageshow/ImageRedEye.java
+++ b/src/com/android/gallery3d/filtershow/imageshow/ImageRedEye.java
@@ -9,6 +9,7 @@ import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.RectF;
import android.util.AttributeSet;
+import android.util.Log;
import android.view.MotionEvent;
import com.android.gallery3d.filtershow.editors.EditorRedEye;
@@ -119,7 +120,6 @@ public class ImageRedEye extends ImageShow {
Matrix originalRotateToScreen = geo.getOriginalToScreen(true,
mImageLoader.getOriginalBounds().width(),
mImageLoader.getOriginalBounds().height(), getWidth(), getHeight());
-
if (mRedEyeRep != null) {
for (RedEyeCandidate candidate : mRedEyeRep.getCandidates()) {
RectF rect = candidate.getRect();