diff options
author | John Hoford <hoford@google.com> | 2013-02-12 11:55:50 -0800 |
---|---|---|
committer | John Hoford <hoford@google.com> | 2013-02-12 12:11:35 -0800 |
commit | 7bddc10fbdc91973ba1cf922590e849f0d53c1f2 (patch) | |
tree | 123e8dd8b6d47d60f8d438fc2b8c33185425d4ef | |
parent | 627bd81fc0a71f6401a4e4ea4014c55353a706bd (diff) | |
download | android_packages_apps_Snap-7bddc10fbdc91973ba1cf922590e849f0d53c1f2.tar.gz android_packages_apps_Snap-7bddc10fbdc91973ba1cf922590e849f0d53c1f2.tar.bz2 android_packages_apps_Snap-7bddc10fbdc91973ba1cf922590e849f0d53c1f2.zip |
refactor quality to be int
Change-Id: I0470abdbe75cf48c5228e80b9dc060ae6f3d8bbd
4 files changed, 38 insertions, 12 deletions
diff --git a/res/menu/filtershow_menu_draw.xml b/res/menu/filtershow_menu_draw.xml index 9455f70a7..2960c1f05 100644 --- a/res/menu/filtershow_menu_draw.xml +++ b/res/menu/filtershow_menu_draw.xml @@ -33,6 +33,9 @@ <item android:id="@+id/draw_menu_color" android:title="@string/draw_color"/> + <item + android:id="@+id/draw_menu_clear" + android:title="@string/draw_clear"/> </group> </menu>
\ No newline at end of file diff --git a/res/values/filtershow_strings.xml b/res/values/filtershow_strings.xml index cf6e80d68..66fb3902d 100644 --- a/res/values/filtershow_strings.xml +++ b/res/values/filtershow_strings.xml @@ -166,6 +166,8 @@ <string name="draw_style_brush_spatter">Marker</string> <!-- Label for the Spatter brush style of drawing in [CHAR LIMIT=14] --> <string name="draw_style_brush_marker">Spatter</string> + <!-- Label for the removing drawing from screen [CHAR LIMIT=14] --> + <string name="draw_clear">Clear</string> <!-- Label for the select the color [CHAR LIMIT=30] --> <string name="color_pick_select">Choose custom color</string> diff --git a/src/com/android/gallery3d/filtershow/filters/FilterDrawRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterDrawRepresentation.java index b8fa0a3d4..b2e1ed39b 100644 --- a/src/com/android/gallery3d/filtershow/filters/FilterDrawRepresentation.java +++ b/src/com/android/gallery3d/filtershow/filters/FilterDrawRepresentation.java @@ -17,6 +17,8 @@ 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; @@ -30,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 + " , " @@ -57,7 +59,8 @@ public class FilterDrawRepresentation extends FilterRepresentation { @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() { @@ -95,6 +98,8 @@ public class FilterDrawRepresentation extends FilterRepresentation { } catch (CloneNotSupportedException e) { e.printStackTrace(); } + } else { + Log.v(LOGTAG, "cannot use parameters from " + a); } } @@ -104,8 +109,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; } @@ -117,14 +132,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/presets/ImagePreset.java b/src/com/android/gallery3d/filtershow/presets/ImagePreset.java index c7d14e80b..adea9deb3 100644 --- a/src/com/android/gallery3d/filtershow/presets/ImagePreset.java +++ b/src/com/android/gallery3d/filtershow/presets/ImagePreset.java @@ -35,7 +35,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>(); @@ -380,14 +383,14 @@ 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); + 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); } } @@ -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) { |