android:layout_height="wrap_content"
android:layout_weight="1" >
- <com.android.gallery3d.filtershow.imageshow.ImageZoom
+ <com.android.gallery3d.filtershow.imageshow.ImageShow
android:id="@+id/imageZoom"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
@Override
public void reflectCurrentFilter() {
super.reflectCurrentFilter();
-
FilterRepresentation rep = getLocalRepresentation();
if (rep != null && getLocalRepresentation() instanceof FilterRedEyeRepresentation) {
FilterRedEyeRepresentation redEyeRep = (FilterRedEyeRepresentation) rep;
+
mImageRedEyes.setRepresentation(redEyeRep);
}
}
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);
}
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;
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);
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...
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();
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;
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;
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;
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;
}
}
}
@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...
return representation;
}
+ @Override
+ public void useRepresentation(FilterRepresentation representation) {
+
+ }
+
native protected void nativeApplyFilter(Bitmap bitmap, int w, int h, int locX, int locY);
@Override
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;
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();