summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow/filters/FilterRedEyeRepresentation.java
diff options
context:
space:
mode:
authorJohn Hoford <hoford@google.com>2013-02-14 15:08:28 -0800
committerJohn Hoford <hoford@google.com>2013-02-14 15:33:30 -0800
commit7847563eaa8e039cd196a695485c322d81b1967e (patch)
tree45ad68e1db00eab55d52089b1a8ad62db1787cdd /src/com/android/gallery3d/filtershow/filters/FilterRedEyeRepresentation.java
parent3c2fca3fe03888a3db308eea5e69b38479433706 (diff)
downloadandroid_packages_apps_Snap-7847563eaa8e039cd196a695485c322d81b1967e.tar.gz
android_packages_apps_Snap-7847563eaa8e039cd196a695485c322d81b1967e.tar.bz2
android_packages_apps_Snap-7847563eaa8e039cd196a695485c322d81b1967e.zip
refactor to support many filter based on RedEye
Change-Id: I92ff19d8f750f5bf4c188129580e22990874501e
Diffstat (limited to 'src/com/android/gallery3d/filtershow/filters/FilterRedEyeRepresentation.java')
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterRedEyeRepresentation.java69
1 files changed, 4 insertions, 65 deletions
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterRedEyeRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterRedEyeRepresentation.java
index 7779211df..70d016f69 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterRedEyeRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterRedEyeRepresentation.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,80 +24,19 @@ import com.android.gallery3d.filtershow.editors.EditorRedEye;
import java.util.Vector;
-public class FilterRedEyeRepresentation extends FilterRepresentation {
+public class FilterRedEyeRepresentation extends FilterPointRepresentation {
private static final String LOGTAG = "FilterRedEyeRepresentation";
- private Vector<RedEyeCandidate> mCandidates = new Vector<RedEyeCandidate>();
public FilterRedEyeRepresentation() {
- super("RedEye");
+ super("RedEye",R.string.redeye,EditorRedEye.ID);
setFilterClass(ImageFilterRedEye.class);
- setPriority(FilterRepresentation.TYPE_NORMAL);
- setTextId(R.string.redeye);
- setEditorId(EditorRedEye.ID);
setOverlayId(R.drawable.photoeditor_effect_redeye);
}
- @Override
- public FilterRepresentation clone() throws CloneNotSupportedException {
- FilterRedEyeRepresentation representation = (FilterRedEyeRepresentation) super
- .clone();
- representation.mCandidates = (Vector<RedEyeCandidate>) mCandidates.clone();
- return representation;
- }
-
- public boolean hasCandidates() {
- return mCandidates != null;
- }
-
- public Vector<RedEyeCandidate> getCandidates() {
- return mCandidates;
- }
-
- public void setCandidates(Vector<RedEyeCandidate> mCandidates) {
- this.mCandidates = mCandidates;
- }
-
- public RedEyeCandidate getCandidate(int index) {
- return this.mCandidates.get(index);
- }
-
- public void addCandidate(RedEyeCandidate c) {
- 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);
- }
-
- public void clearCandidates() {
- this.mCandidates.clear();
- }
-
- public int getNumberOfCandidates() {
- if (mCandidates == null) {
- return 0;
- }
- return mCandidates.size();
- }
-
public void addRect(RectF rect, RectF bounds) {
- if (!hasCandidates()) {
- setCandidates(new Vector<RedEyeCandidate>());
- }
Vector<RedEyeCandidate> intersects = new Vector<RedEyeCandidate>();
for (int i = 0; i < getCandidates().size(); i++) {
- RedEyeCandidate r = getCandidate(i);
+ RedEyeCandidate r = (RedEyeCandidate) getCandidate(i);
if (r.intersect(rect)) {
intersects.add(r);
}