summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterBasicRepresentation.java4
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterColorBorderRepresentation.java15
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterCurvesRepresentation.java9
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterDrawRepresentation.java36
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java8
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterImageBorderRepresentation.java33
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterRedEyeRepresentation.java103
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java108
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterTinyPlanetRepresentation.java65
-rw-r--r--src/com/android/gallery3d/filtershow/presets/ImagePreset.java37
10 files changed, 362 insertions, 56 deletions
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterBasicRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterBasicRepresentation.java
index f6f308dba..2410ebe72 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterBasicRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterBasicRepresentation.java
@@ -121,4 +121,8 @@ public class FilterBasicRepresentation extends FilterRepresentation {
public void setPreviewValue(int previewValue) {
mPreviewValue = previewValue;
}
+
+ public String getStateRepresentation() {
+ return "" + getValue();
+ }
}
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterColorBorderRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterColorBorderRepresentation.java
index 3ea678c44..b2664a30f 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterColorBorderRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterColorBorderRepresentation.java
@@ -16,6 +16,9 @@
package com.android.gallery3d.filtershow.filters;
+import com.android.gallery3d.R;
+import com.android.gallery3d.filtershow.editors.ImageOnlyEditor;
+
public class FilterColorBorderRepresentation extends FilterRepresentation {
private int mColor;
private int mBorderSize;
@@ -27,7 +30,12 @@ public class FilterColorBorderRepresentation extends FilterRepresentation {
mBorderSize = size;
mBorderRadius = radius;
setFilterClass(ImageFilterParametricBorder.class);
- setPriority(ImageFilter.TYPE_BORDER);
+ setPriority(FilterRepresentation.TYPE_BORDER);
+ setTextId(R.string.borders);
+ setEditorId(ImageOnlyEditor.ID);
+ setShowEditingControls(false);
+ setShowParameterValue(false);
+ setShowUtilityPanel(false);
}
public String toString() {
@@ -74,6 +82,11 @@ public class FilterColorBorderRepresentation extends FilterRepresentation {
return true;
}
+ @Override
+ public int getTextId() {
+ return R.string.borders;
+ }
+
public int getColor() {
return mColor;
}
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterCurvesRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterCurvesRepresentation.java
index 5234023d0..6c831708e 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterCurvesRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterCurvesRepresentation.java
@@ -1,5 +1,6 @@
package com.android.gallery3d.filtershow.filters;
+import com.android.gallery3d.R;
import com.android.gallery3d.filtershow.ui.Spline;
/**
@@ -10,6 +11,14 @@ public class FilterCurvesRepresentation extends FilterRepresentation {
public FilterCurvesRepresentation() {
super("Curves");
+ setFilterClass(ImageFilterCurves.class);
+ setTextId(R.string.curvesRGB);
+ setButtonId(R.id.curvesButtonRGB);
+ setOverlayId(R.drawable.filtershow_button_colors_curve);
+ setEditorId(R.id.imageCurves);
+ setShowEditingControls(false);
+ setShowParameterValue(false);
+ setShowUtilityPanel(true);
for (int i = 0; i < mSplines.length; i++) {
mSplines[i] = new Spline();
mSplines[i].reset();
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterDrawRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterDrawRepresentation.java
index 1cb2645c7..e41f0a622 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterDrawRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterDrawRepresentation.java
@@ -17,6 +17,10 @@
package com.android.gallery3d.filtershow.filters;
import android.graphics.Path;
+import android.util.Log;
+
+import com.android.gallery3d.R;
+import com.android.gallery3d.filtershow.editors.EditorDraw;
import java.util.Vector;
@@ -28,7 +32,7 @@ public class FilterDrawRepresentation extends FilterRepresentation {
public Path mPath;
public float mRadius;
public int mColor;
-
+ public int noPoints = 0;
@Override
public String toString() {
return "stroke(" + mType + ", path(" + (mPath) + "), " + mRadius + " , "
@@ -45,12 +49,18 @@ public class FilterDrawRepresentation extends FilterRepresentation {
public FilterDrawRepresentation() {
super("Draw");
+ setFilterClass(ImageFilterDraw.class);
+ setPriority(FilterRepresentation.TYPE_VIGNETTE);
+ setTextId(R.string.imageDraw);
+ setButtonId(R.id.drawOnImageButton);
+ setEditorId(EditorDraw.ID);
}
@Override
public String toString() {
return getName() + " : strokes=" + mDrawing.size()
- + ((mCurrent == null) ? " no current " : ("current=" + mCurrent.mType));
+ + ((mCurrent == null) ? " no current "
+ : ("draw=" + mCurrent.mType + " " + mCurrent.noPoints));
}
public Vector<StrokeData> getDrawing() {
@@ -84,10 +94,15 @@ public class FilterDrawRepresentation extends FilterRepresentation {
}
if (representation.mDrawing != null) {
mDrawing = (Vector<StrokeData>) representation.mDrawing.clone();
+ } else {
+ mDrawing = null;
}
+
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
+ } else {
+ Log.v(LOGTAG, "cannot use parameters from " + a);
}
}
@@ -97,8 +112,18 @@ public class FilterDrawRepresentation extends FilterRepresentation {
return false;
}
if (representation instanceof FilterDrawRepresentation) {
- // FIXME!
- return true;
+ FilterDrawRepresentation fdRep = (FilterDrawRepresentation) representation;
+ if (fdRep.mDrawing.size() != mDrawing.size())
+ return false;
+ if (fdRep.mCurrent == null && mCurrent.mPath == null) {
+ return true;
+ }
+ if (fdRep.mCurrent != null && mCurrent.mPath != null) {
+ if (fdRep.mCurrent.noPoints == mCurrent.noPoints) {
+ return true;
+ }
+ return false;
+ }
}
return false;
}
@@ -110,14 +135,17 @@ public class FilterDrawRepresentation extends FilterRepresentation {
mCurrent.mType = type;
mCurrent.mPath = new Path();
mCurrent.mPath.moveTo(x, y);
+ mCurrent.noPoints = 0;
}
public void addPoint(float x, float y) {
+ mCurrent.noPoints++;
mCurrent.mPath.lineTo(x, y);
}
public void endSection(float x, float y) {
mCurrent.mPath.lineTo(x, y);
+ mCurrent.noPoints++;
mDrawing.add(mCurrent);
mCurrent = null;
}
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java
index 5aff39df4..859bf327c 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java
@@ -17,7 +17,7 @@
package com.android.gallery3d.filtershow.filters;
import android.graphics.Bitmap;
-import com.android.gallery3d.app.Log;
+import com.android.gallery3d.filtershow.editors.ImageOnlyEditor;
public class FilterFxRepresentation extends FilterRepresentation {
private Bitmap mFxBitmap = null;
@@ -31,6 +31,12 @@ public class FilterFxRepresentation extends FilterRepresentation {
mBitmapResource = bitmapResource;
mNameResource = nameResource;
setFilterClass(ImageFilterFx.class);
+ setPriority(FilterRepresentation.TYPE_FX);
+ setTextId(nameResource);
+ setEditorId(ImageOnlyEditor.ID);
+ setShowEditingControls(false);
+ setShowParameterValue(false);
+ setShowUtilityPanel(false);
}
public String toString() {
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterImageBorderRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterImageBorderRepresentation.java
index 467409fb8..99c809148 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterImageBorderRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterImageBorderRepresentation.java
@@ -16,18 +16,26 @@
package com.android.gallery3d.filtershow.filters;
-import android.graphics.drawable.Drawable;
+import com.android.gallery3d.R;
+import com.android.gallery3d.filtershow.editors.ImageOnlyEditor;
public class FilterImageBorderRepresentation extends FilterRepresentation {
- private Drawable mDrawable;
private int mDrawableResource = 0;
- public FilterImageBorderRepresentation(int drawableResource, Drawable drawable) {
+ public FilterImageBorderRepresentation(int drawableResource) {
super("ImageBorder");
mDrawableResource = drawableResource;
- mDrawable = drawable;
setFilterClass(ImageFilterBorder.class);
- setPriority(ImageFilter.TYPE_BORDER);
+ setPriority(FilterRepresentation.TYPE_BORDER);
+ setTextId(R.string.borders);
+ setEditorId(ImageOnlyEditor.ID);
+ setShowEditingControls(false);
+ setShowParameterValue(false);
+ setShowUtilityPanel(false);
+ // load the drawable at init as we are in a background thread
+ // (see FilterShowActivity's LoadBordersTask)
+ ImageFilterBorder filter = (ImageFilterBorder) FiltersManager.getManager().getFilter(getFilterClass());
+ filter.getDrawable(getDrawableResource());
}
public String toString() {
@@ -38,7 +46,6 @@ public class FilterImageBorderRepresentation extends FilterRepresentation {
public FilterRepresentation clone() throws CloneNotSupportedException {
FilterImageBorderRepresentation representation = (FilterImageBorderRepresentation) super.clone();
representation.setName(getName());
- representation.setDrawable(getDrawable());
representation.setDrawableResource(getDrawableResource());
return representation;
}
@@ -47,7 +54,6 @@ public class FilterImageBorderRepresentation extends FilterRepresentation {
if (a instanceof FilterImageBorderRepresentation) {
FilterImageBorderRepresentation representation = (FilterImageBorderRepresentation) a;
setName(representation.getName());
- setDrawable(representation.getDrawable());
setDrawableResource(representation.getDrawableResource());
}
}
@@ -66,16 +72,13 @@ public class FilterImageBorderRepresentation extends FilterRepresentation {
return false;
}
- public boolean allowsMultipleInstances() {
- return true;
- }
-
- public Drawable getDrawable() {
- return mDrawable;
+ @Override
+ public int getTextId() {
+ return R.string.borders;
}
- public void setDrawable(Drawable drawable) {
- mDrawable = drawable;
+ public boolean allowsMultipleInstances() {
+ return true;
}
public int getDrawableResource() {
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterRedEyeRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterRedEyeRepresentation.java
new file mode 100644
index 000000000..329f5204e
--- /dev/null
+++ b/src/com/android/gallery3d/filtershow/filters/FilterRedEyeRepresentation.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2012 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.gallery3d.filtershow.filters;
+
+import android.graphics.RectF;
+import android.util.Log;
+
+import com.android.gallery3d.R;
+import com.android.gallery3d.filtershow.editors.EditorRedEye;
+
+import java.util.Vector;
+
+public class FilterRedEyeRepresentation extends FilterRepresentation {
+ private static final String LOGTAG = "FilterRedEyeRepresentation";
+ private Vector<RedEyeCandidate> mCandidates = new Vector<RedEyeCandidate>();
+
+ public FilterRedEyeRepresentation() {
+ super("RedEye");
+ 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);
+ }
+
+ 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);
+ if (r.intersect(rect)) {
+ intersects.add(r);
+ }
+ }
+ for (int i = 0; i < intersects.size(); i++) {
+ RedEyeCandidate r = intersects.elementAt(i);
+ rect.union(r.mRect);
+ bounds.union(r.mBounds);
+ removeCandidate(r);
+ }
+ addCandidate(new RedEyeCandidate(rect, bounds));
+ }
+
+}
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java
index 7d9d7f923..8ac191de7 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java
@@ -17,17 +17,28 @@
package com.android.gallery3d.filtershow.filters;
import com.android.gallery3d.app.Log;
+import com.android.gallery3d.filtershow.editors.BasicEditor;
import com.android.gallery3d.filtershow.presets.ImagePreset;
-import java.util.HashMap;
-
public class FilterRepresentation implements Cloneable {
private static final String LOGTAG = "FilterRepresentation";
private String mName;
- private int mPriority;
- private ImagePreset mPreset;
- private boolean mShowParameterValue;
+ private int mPriority = TYPE_NORMAL;
private Class mFilterClass;
+ private int mTextId = 0;
+ private int mEditorId = BasicEditor.ID;
+ private int mButtonId = 0;
+ private int mOverlayId = 0;
+ private boolean mShowEditingControls = true;
+ private boolean mShowParameterValue = true;
+ private boolean mShowUtilityPanel = true;
+
+ public static final byte TYPE_BORDER = 1;
+ public static final byte TYPE_FX = 2;
+ public static final byte TYPE_WBALANCE = 3;
+ public static final byte TYPE_VIGNETTE = 4;
+ public static final byte TYPE_NORMAL = 5;
+ public static final byte TYPE_TINYPLANET = 6;
public FilterRepresentation(String name) {
mName = name;
@@ -39,6 +50,13 @@ public class FilterRepresentation implements Cloneable {
representation.setName(getName());
representation.setPriority(getPriority());
representation.setFilterClass(getFilterClass());
+ representation.setTextId(getTextId());
+ representation.setEditorId(getEditorId());
+ representation.setButtonId(getButtonId());
+ representation.setOverlayId(getOverlayId());
+ representation.setShowEditingControls(showEditingControls());
+ representation.setShowParameterValue(showParameterValue());
+ representation.setShowUtilityPanel(showUtilityPanel());
Log.v(LOGTAG, "cloning from <" + this + "> to <" + representation + ">");
return representation;
}
@@ -50,7 +68,13 @@ public class FilterRepresentation implements Cloneable {
if (representation.mFilterClass == representation.mFilterClass
&& representation.mName.equalsIgnoreCase(mName)
&& representation.mPriority == mPriority
- && representation.mShowParameterValue == mShowParameterValue) {
+ && representation.mTextId == mTextId
+ && representation.mEditorId == mEditorId
+ && representation.mButtonId == mButtonId
+ && representation.mOverlayId == mOverlayId
+ && representation.mShowEditingControls == mShowEditingControls
+ && representation.mShowParameterValue == mShowParameterValue
+ && representation.mShowUtilityPanel == mShowUtilityPanel) {
return true;
}
return false;
@@ -76,10 +100,6 @@ public class FilterRepresentation implements Cloneable {
return mPriority;
}
- public void setImagePreset(ImagePreset preset) {
- mPreset = preset;
- }
-
public boolean isNil() {
return false;
}
@@ -87,14 +107,6 @@ public class FilterRepresentation implements Cloneable {
public void useParametersFrom(FilterRepresentation a) {
}
- public void setShowParameterValue(boolean showParameterValue) {
- mShowParameterValue = showParameterValue;
- }
-
- public boolean showParameterValue() {
- return mShowParameterValue;
- }
-
public boolean allowsMultipleInstances() {
return false;
}
@@ -113,4 +125,64 @@ public class FilterRepresentation implements Cloneable {
}
return getFilterClass() == b.getFilterClass();
}
+
+ public int getTextId() {
+ return mTextId;
+ }
+
+ public void setTextId(int textId) {
+ mTextId = textId;
+ }
+
+ public int getButtonId() {
+ return mButtonId;
+ }
+
+ public void setButtonId(int buttonId) {
+ mButtonId = buttonId;
+ }
+
+ public int getOverlayId() {
+ return mOverlayId;
+ }
+
+ public void setOverlayId(int overlayId) {
+ mOverlayId = overlayId;
+ }
+
+ public int getEditorId() {
+ return mEditorId;
+ }
+
+ public void setEditorId(int editorId) {
+ mEditorId = editorId;
+ }
+
+ public boolean showEditingControls() {
+ return mShowEditingControls;
+ }
+
+ public void setShowEditingControls(boolean showEditingControls) {
+ mShowEditingControls = showEditingControls;
+ }
+
+ public boolean showParameterValue() {
+ return mShowParameterValue;
+ }
+
+ public void setShowParameterValue(boolean showParameterValue) {
+ mShowParameterValue = showParameterValue;
+ }
+
+ public boolean showUtilityPanel() {
+ return mShowUtilityPanel;
+ }
+
+ public void setShowUtilityPanel(boolean showUtilityPanel) {
+ mShowUtilityPanel = showUtilityPanel;
+ }
+
+ public String getStateRepresentation() {
+ return "";
+ }
}
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterTinyPlanetRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterTinyPlanetRepresentation.java
new file mode 100644
index 000000000..7b69ce9e0
--- /dev/null
+++ b/src/com/android/gallery3d/filtershow/filters/FilterTinyPlanetRepresentation.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2012 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.gallery3d.filtershow.filters;
+
+import com.android.gallery3d.R;
+import com.android.gallery3d.filtershow.editors.EditorTinyPlanet;
+
+public class FilterTinyPlanetRepresentation extends FilterBasicRepresentation {
+ private static final String LOGTAG = "FilterTinyPlanetRepresentation";
+ private float mAngle = 0;
+
+ public FilterTinyPlanetRepresentation() {
+ super("TinyPlanet", 0, 50, 100);
+ setShowParameterValue(true);
+ setFilterClass(ImageFilterTinyPlanet.class);
+ setPriority(FilterRepresentation.TYPE_TINYPLANET);
+ setTextId(R.string.tinyplanet);
+ setButtonId(R.id.tinyplanetButton);
+ setEditorId(EditorTinyPlanet.ID);
+ }
+
+ @Override
+ public FilterRepresentation clone() throws CloneNotSupportedException {
+ FilterTinyPlanetRepresentation representation = (FilterTinyPlanetRepresentation) super
+ .clone();
+ representation.mAngle = mAngle;
+ representation.setZoom(getZoom());
+ return representation;
+ }
+
+ public void setAngle(float angle) {
+ mAngle = angle;
+ }
+
+ public float getAngle() {
+ return mAngle;
+ }
+
+ public int getZoom() {
+ return getValue();
+ }
+
+ public void setZoom(int zoom) {
+ setValue(zoom);
+ }
+
+ public boolean isNil() {
+ // TinyPlanet always has an effect
+ return false;
+ }
+}
diff --git a/src/com/android/gallery3d/filtershow/presets/ImagePreset.java b/src/com/android/gallery3d/filtershow/presets/ImagePreset.java
index fb58d1ff9..3ee55ada5 100644
--- a/src/com/android/gallery3d/filtershow/presets/ImagePreset.java
+++ b/src/com/android/gallery3d/filtershow/presets/ImagePreset.java
@@ -21,6 +21,7 @@ import android.util.Log;
import com.android.gallery3d.filtershow.ImageStateAdapter;
import com.android.gallery3d.filtershow.cache.ImageLoader;
+import com.android.gallery3d.filtershow.filters.BaseFiltersManager;
import com.android.gallery3d.filtershow.filters.FilterRepresentation;
import com.android.gallery3d.filtershow.filters.FiltersManager;
import com.android.gallery3d.filtershow.filters.ImageFilter;
@@ -35,7 +36,10 @@ public class ImagePreset {
private FilterRepresentation mBorder = null;
private float mScaleFactor = 1.0f;
- private boolean mIsHighQuality = false;
+ public static final int QUALITY_ICON = 0;
+ public static final int QUALITY_PREVIEW = 1;
+ public static final int QUALITY_FINAL = 2;
+ private int mQuality = QUALITY_PREVIEW;
private ImageLoader mImageLoader = null;
private Vector<FilterRepresentation> mFilters = new Vector<FilterRepresentation>();
@@ -72,7 +76,6 @@ public class ImagePreset {
}
for (int i = 0; i < source.mFilters.size(); i++) {
FilterRepresentation representation = source.mFilters.elementAt(i).clone();
- representation.setImagePreset(this);
addFilter(representation);
}
} catch (java.lang.CloneNotSupportedException e) {
@@ -172,11 +175,11 @@ public class ImagePreset {
return false;
}
for (FilterRepresentation representation : mFilters) {
- if (representation.getPriority() == ImageFilter.TYPE_VIGNETTE
+ if (representation.getPriority() == FilterRepresentation.TYPE_VIGNETTE
&& !representation.isNil()) {
return false;
}
- if (representation.getPriority() == ImageFilter.TYPE_TINYPLANET
+ if (representation.getPriority() == FilterRepresentation.TYPE_TINYPLANET
&& !representation.isNil()) {
return false;
}
@@ -323,20 +326,20 @@ public class ImagePreset {
public void addFilter(FilterRepresentation representation) {
Log.v(LOGTAG, "*** Add Filter *** " + representation);
- if (representation.getPriority() == ImageFilter.TYPE_BORDER) {
+ if (representation.getPriority() == FilterRepresentation.TYPE_BORDER) {
setHistoryName(representation.getName());
setBorder(representation);
- } else if (representation.getPriority() == ImageFilter.TYPE_FX) {
+ } else if (representation.getPriority() == FilterRepresentation.TYPE_FX) {
boolean found = false;
for (int i = 0; i < mFilters.size(); i++) {
int type = mFilters.elementAt(i).getPriority();
if (found) {
- if (type != ImageFilter.TYPE_VIGNETTE) {
+ if (type != FilterRepresentation.TYPE_VIGNETTE) {
mFilters.remove(i);
continue;
}
}
- if (type == ImageFilter.TYPE_FX) {
+ if (type == FilterRepresentation.TYPE_FX) {
mFilters.remove(i);
mFilters.add(i, representation);
setHistoryName(representation.getName());
@@ -351,7 +354,6 @@ public class ImagePreset {
mFilters.add(representation);
setHistoryName(representation.getName());
}
- representation.setImagePreset(this);
}
public FilterRepresentation getRepresentation(FilterRepresentation filterRepresentation) {
@@ -380,14 +382,15 @@ public class ImagePreset {
public Bitmap applyGeometry(Bitmap bitmap) {
// Apply any transform -- 90 rotate, flip, straighten, crop
// Returns a new bitmap.
- return mGeoData.apply(bitmap, mScaleFactor, mIsHighQuality);
+ return mGeoData.apply(bitmap, mScaleFactor, mQuality);
}
public Bitmap applyBorder(Bitmap bitmap) {
if (mBorder != null && mDoApplyGeometry) {
ImageFilter filter = FiltersManager.getManager().getFilterForRepresentation(mBorder);
filter.useRepresentation(mBorder);
- bitmap = filter.apply(bitmap, mScaleFactor, mIsHighQuality);
+ filter.setImagePreset(this);
+ bitmap = filter.apply(bitmap, mScaleFactor, mQuality);
}
return bitmap;
}
@@ -408,7 +411,7 @@ public class ImagePreset {
}
ImageFilter filter = FiltersManager.getManager().getFilterForRepresentation(representation);
filter.useRepresentation(representation);
- bitmap = filter.apply(bitmap, mScaleFactor, mIsHighQuality);
+ bitmap = filter.apply(bitmap, mScaleFactor, mQuality);
}
}
@@ -421,7 +424,7 @@ public class ImagePreset {
}
imageStateAdapter.clear();
// TODO: re-enable the state panel
- // imageStateAdapter.addAll(mFilters);
+ imageStateAdapter.addAll(mFilters);
imageStateAdapter.notifyDataSetChanged();
}
@@ -429,12 +432,12 @@ public class ImagePreset {
return mScaleFactor;
}
- public boolean isHighQuality() {
- return mIsHighQuality;
+ public int getQuality() {
+ return mQuality;
}
- public void setIsHighQuality(boolean value) {
- mIsHighQuality = value;
+ public void setQuality(int value) {
+ mQuality = value;
}
public void setScaleFactor(float value) {