summaryrefslogtreecommitdiffstats
path: root/src_pd
diff options
context:
space:
mode:
authornicolasroard <nicolasroard@google.com>2013-02-12 20:19:19 (GMT)
committernicolasroard <nicolasroard@google.com>2013-02-12 20:36:32 (GMT)
commit3c3f2336bfc8f6d5fc6d94a807d40df327481df7 (patch)
tree89ce6a5287b233c2f0f43c5c3ec46fc97289dcdc /src_pd
parentc04f50dd1ed5523c21e587bc899e7d3610e68b25 (diff)
downloadandroid_packages_apps_Snap-3c3f2336bfc8f6d5fc6d94a807d40df327481df7.zip
android_packages_apps_Snap-3c3f2336bfc8f6d5fc6d94a807d40df327481df7.tar.gz
android_packages_apps_Snap-3c3f2336bfc8f6d5fc6d94a807d40df327481df7.tar.bz2
Refactor FiltersManager
Change-Id: I4c42ddb90e65e90af873eb8dbe065f4fa3de69ef
Diffstat (limited to 'src_pd')
-rw-r--r--src_pd/com/android/gallery3d/filtershow/filters/FiltersManager.java98
1 files changed, 1 insertions, 97 deletions
diff --git a/src_pd/com/android/gallery3d/filtershow/filters/FiltersManager.java b/src_pd/com/android/gallery3d/filtershow/filters/FiltersManager.java
index 2a1a6da..988cf2d 100644
--- a/src_pd/com/android/gallery3d/filtershow/filters/FiltersManager.java
+++ b/src_pd/com/android/gallery3d/filtershow/filters/FiltersManager.java
@@ -16,39 +16,8 @@
package com.android.gallery3d.filtershow.filters;
-import com.android.gallery3d.filtershow.cache.ImageLoader;
-
-import java.util.HashMap;
-import java.util.Vector;
-
-public class FiltersManager {
-
- private static final String LOGTAG = "FiltersManager";
+public class FiltersManager extends BaseFiltersManager {
private static FiltersManager gInstance = null;
- private static HashMap<Class, ImageFilter> mFilters = new HashMap<Class, ImageFilter>();
-
- private FiltersManager() {
- Vector<ImageFilter> filters = new Vector<ImageFilter>();
- FiltersManager.addFilters(filters);
- filters.add(new ImageFilterFx());
- filters.add(new ImageFilterBorder());
- filters.add(new ImageFilterParametricBorder());
- for (ImageFilter filter : filters) {
- mFilters.put(filter.getClass(), filter);
- }
- }
-
- public ImageFilter getFilter(Class c) {
- return mFilters.get(c);
- }
-
- public ImageFilter getFilterForRepresentation(FilterRepresentation representation) {
- return mFilters.get(representation.getFilterClass());
- }
-
- public void addFilter(Class filterClass, ImageFilter filter) {
- mFilters.put(filterClass, filter);
- }
public static FiltersManager getManager() {
if (gInstance == null) {
@@ -56,69 +25,4 @@ public class FiltersManager {
}
return gInstance;
}
-
- public static FilterRepresentation getRepresentation(Class c) {
- ImageFilter filter = mFilters.get(c);
- if (filter != null) {
- return filter.getDefaultRepresentation();
- }
- return null;
- }
-
- public static void addFilterRepresentations(Vector<FilterRepresentation> representations) {
- representations.add(getRepresentation(ImageFilterTinyPlanet.class));
- representations.add(getRepresentation(ImageFilterRedEye.class));
- representations.add(getRepresentation(ImageFilterWBalance.class));
- representations.add(getRepresentation(ImageFilterExposure.class));
- representations.add(getRepresentation(ImageFilterVignette.class));
- representations.add(getRepresentation(ImageFilterContrast.class));
- representations.add(getRepresentation(ImageFilterShadows.class));
- representations.add(getRepresentation(ImageFilterVibrance.class));
- representations.add(getRepresentation(ImageFilterSharpen.class));
- representations.add(getRepresentation(ImageFilterCurves.class));
- representations.add(getRepresentation(ImageFilterDraw.class));
- representations.add(getRepresentation(ImageFilterHue.class));
- representations.add(getRepresentation(ImageFilterSaturated.class));
- representations.add(getRepresentation(ImageFilterBwFilter.class));
- representations.add(getRepresentation(ImageFilterNegative.class));
- representations.add(getRepresentation(ImageFilterEdge.class));
- representations.add(getRepresentation(ImageFilterKMeans.class));
- }
-
- public static void addFilters(Vector<ImageFilter> filters) {
- filters.add(new ImageFilterTinyPlanet());
- filters.add(new ImageFilterRedEye());
- filters.add(new ImageFilterWBalance());
- filters.add(new ImageFilterExposure());
- filters.add(new ImageFilterVignette());
- filters.add(new ImageFilterContrast());
- filters.add(new ImageFilterShadows());
- filters.add(new ImageFilterVibrance());
- filters.add(new ImageFilterSharpen());
- filters.add(new ImageFilterCurves());
- filters.add(new ImageFilterDraw());
- filters.add(new ImageFilterHue());
- filters.add(new ImageFilterSaturated());
- filters.add(new ImageFilterBwFilter());
- filters.add(new ImageFilterNegative());
- filters.add(new ImageFilterEdge());
- filters.add(new ImageFilterKMeans());
- }
-
- public static void addFilters(Vector<ImageFilter> filters, ImageLoader imageLoader) {
- FiltersManager.addFilters(filters);
- filters.add(new ImageFilterDownsample(imageLoader));
- FiltersManager.getManager().addFilter(ImageFilterDownsample.class,
- new ImageFilterDownsample(imageLoader));
- }
-
- public void resetBitmapsRS() {
- for (Class c : mFilters.keySet()) {
- ImageFilter filter = mFilters.get(c);
- if (filter instanceof ImageFilterRS) {
- ImageFilterRS filterRS = (ImageFilterRS) filter;
- filterRS.resetBitmap();
- }
- }
- }
}