diff options
author | John Hoford <hoford@google.com> | 2013-04-18 03:18:38 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-04-18 03:18:38 +0000 |
commit | 29b7511a1a41a43796c3890b272486f89a268105 (patch) | |
tree | 4933376d6085609cf0e16a4adcea05ca4e7ce452 /src/com/android/gallery3d/filtershow/filters/FilterVignetteRepresentation.java | |
parent | 919f2a4cf0964aab2b03d6aa81e7b0fc3c83e11c (diff) | |
parent | 0c53bbc7da61556d5af8e7f8c6be6cf96432012e (diff) | |
download | android_packages_apps_Snap-29b7511a1a41a43796c3890b272486f89a268105.tar.gz android_packages_apps_Snap-29b7511a1a41a43796c3890b272486f89a268105.tar.bz2 android_packages_apps_Snap-29b7511a1a41a43796c3890b272486f89a268105.zip |
Merge "Support for save state in images" into gb-ub-photos-carlsbad
Diffstat (limited to 'src/com/android/gallery3d/filtershow/filters/FilterVignetteRepresentation.java')
-rw-r--r-- | src/com/android/gallery3d/filtershow/filters/FilterVignetteRepresentation.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterVignetteRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterVignetteRepresentation.java index eef54ef58..9827088ff 100644 --- a/src/com/android/gallery3d/filtershow/filters/FilterVignetteRepresentation.java +++ b/src/com/android/gallery3d/filtershow/filters/FilterVignetteRepresentation.java @@ -29,6 +29,7 @@ public class FilterVignetteRepresentation extends FilterBasicRepresentation impl public FilterVignetteRepresentation() { super("Vignette", -100, 50, 100); + setSerializationName("VIGNETTE"); setShowParameterValue(true); setPriority(FilterRepresentation.TYPE_VIGNETTE); setTextId(R.string.vignette); @@ -111,4 +112,44 @@ public class FilterVignetteRepresentation extends FilterBasicRepresentation impl public boolean isNil() { return getValue() == 0; } + + private static final String[] sParams = { + "Name", "value", "mCenterX", "mCenterY", "mRadiusX", + "mRadiusY" + }; + + @Override + public String[][] serializeRepresentation() { + String[][] ret = { + { sParams[0], getName() }, + { sParams[1], Integer.toString(getValue()) }, + { sParams[2], Float.toString(mCenterX) }, + { sParams[3], Float.toString(mCenterY) }, + { sParams[4], Float.toString(mRadiusX) }, + { sParams[5], Float.toString(mRadiusY) } + }; + return ret; + } + + @Override + public void deSerializeRepresentation(String[][] rep) { + super.deSerializeRepresentation(rep); + for (int i = 0; i < rep.length; i++) { + String key = rep[i][0]; + String value = rep[i][1]; + if (sParams[0].equals(key)) { + setName(value); + } else if (sParams[1].equals(key)) { + setValue(Integer.parseInt(value)); + } else if (sParams[2].equals(key)) { + mCenterX = Float.parseFloat(value); + } else if (sParams[3].equals(key)) { + mCenterY = Float.parseFloat(value); + } else if (sParams[4].equals(key)) { + mRadiusX = Float.parseFloat(value); + } else if (sParams[5].equals(key)) { + mRadiusY = Float.parseFloat(value); + } + } + } } |