summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/gallery3d/filtershow/FilterShowActivity.java37
-rw-r--r--src/com/android/gallery3d/filtershow/PanelController.java48
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterColorBorderRepresentation.java13
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterCurvesRepresentation.java9
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterDrawRepresentation.java7
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java7
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterImageBorderRepresentation.java13
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java90
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterTinyPlanetRepresentation.java13
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilter.java31
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterBorder.java26
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterBwFilter.java12
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterContrast.java12
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterCurves.java35
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterDownsample.java12
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterDraw.java30
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterEdge.java12
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterExposure.java12
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterFx.java29
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterGradient.java115
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterHue.java18
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterKMeans.java12
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterNegative.java28
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterParametricBorder.java20
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterRedEye.java3
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterSaturated.java12
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterShadows.java12
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterSharpen.java28
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterTinyPlanet.java31
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterVibrance.java12
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterVignette.java12
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterWBalance.java21
-rw-r--r--src/com/android/gallery3d/filtershow/filters/SimpleImageFilter.java4
-rw-r--r--src/com/android/gallery3d/filtershow/ui/FilterIconButton.java12
-rw-r--r--src_pd/com/android/gallery3d/filtershow/filters/FiltersManager.java27
35 files changed, 245 insertions, 570 deletions
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
index 5859be0..d29d5eb 100644
--- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java
+++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
@@ -280,13 +280,12 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
mPanelController.addPanel(mColorsButton, mListColors, 3);
- Vector<ImageFilter> filters = new Vector<ImageFilter>();
- FiltersManager.addFilters(filters, mImageLoader);
-
- for (ImageFilter filter : filters) {
- filter.setName(getString(filter.getTextId()));
- setupFilterButton(filter, listColors, mColorsButton);
+ Vector<FilterRepresentation> filtersRepresentations = new Vector<FilterRepresentation>();
+ FiltersManager.addFilterRepresentations(filtersRepresentations);
+ for (FilterRepresentation representation : filtersRepresentations) {
+ setupFilterRepresentationButton(representation, listColors, mColorsButton);
}
+
mPanelController.addFilter(new ImageFilterRedEye());
mPanelController.addView(findViewById(R.id.applyEffect));
@@ -711,31 +710,17 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
(LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
FilterIconButton icon = (FilterIconButton) inflater.inflate(R.layout.filtericonbutton,
panel, false);
+ if (representation.getTextId() != 0) {
+ representation.setName(getString(representation.getTextId()));
+ }
String text = representation.getName();
icon.setup(text, this, panel);
icon.setFilterRepresentation(representation);
- mPanelController.addComponent(button, icon);
- panel.addView(icon);
- return icon;
- }
-
- public FilterIconButton setupFilterButton(ImageFilter filter, LinearLayout panel, View button) {
- LayoutInflater inflater =
- (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- FilterIconButton icon = (FilterIconButton) inflater.inflate(R.layout.filtericonbutton,
- panel, false);
- String text = filter.getName();
- if (filter instanceof ImageFilterBorder || filter instanceof ImageFilterParametricBorder) {
- text = "";
- }
- icon.setup(text, filter, this, panel);
- // TODO: get rid of hasDefaultRepresentation()
- if (filter.hasDefaultRepresentation()) {
- icon.setFilterRepresentation(filter.getDefaultRepresentation());
+ if (representation instanceof FilterTinyPlanetRepresentation) {
+ // needed to hide tinyplanet on startup
+ icon.setId(R.id.tinyplanetButton);
}
- icon.setId(filter.getButtonId());
mPanelController.addComponent(button, icon);
- mPanelController.addFilter(filter);
panel.addView(icon);
return icon;
}
diff --git a/src/com/android/gallery3d/filtershow/PanelController.java b/src/com/android/gallery3d/filtershow/PanelController.java
index 2a97e7e..e414014 100644
--- a/src/com/android/gallery3d/filtershow/PanelController.java
+++ b/src/com/android/gallery3d/filtershow/PanelController.java
@@ -18,7 +18,6 @@ package com.android.gallery3d.filtershow;
import android.content.Context;
import android.text.Html;
-import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewPropertyAnimator;
@@ -27,6 +26,7 @@ import android.widget.TextView;
import com.android.gallery3d.R;
import com.android.gallery3d.filtershow.editors.Editor;
+import com.android.gallery3d.filtershow.filters.FilterRepresentation;
import com.android.gallery3d.filtershow.filters.ImageFilter;
import com.android.gallery3d.filtershow.filters.ImageFilterTinyPlanet;
import com.android.gallery3d.filtershow.imageshow.ImageCrop;
@@ -34,7 +34,6 @@ import com.android.gallery3d.filtershow.imageshow.ImageShow;
import com.android.gallery3d.filtershow.imageshow.MasterImage;
import com.android.gallery3d.filtershow.presets.ImagePreset;
import com.android.gallery3d.filtershow.ui.FilterIconButton;
-import com.android.gallery3d.filtershow.ui.FramedTextButton;
import java.util.HashMap;
import java.util.Vector;
@@ -233,7 +232,6 @@ public class PanelController implements OnClickListener {
private View mCurrentPanel = null;
private View mRowPanel = null;
private UtilityPanel mUtilityPanel = null;
- private MasterImage mMasterImage = MasterImage.getImage();
private ImageShow mCurrentImage = null;
private Editor mCurrentEditor = null;
private FilterShowActivity mActivity = null;
@@ -294,9 +292,9 @@ public class PanelController implements OnClickListener {
if (mUtilityPanel == null || !mUtilityPanel.selected()) {
return true;
}
- HistoryAdapter adapter = mMasterImage.getHistory();
+ HistoryAdapter adapter = MasterImage.getImage().getHistory();
int position = adapter.undo();
- mMasterImage.onHistoryItemClick(position);
+ MasterImage.getImage().onHistoryItemClick(position);
showPanel(mCurrentPanel);
mCurrentImage.select();
if (mCurrentEditor != null) {
@@ -359,8 +357,8 @@ public class PanelController implements OnClickListener {
public void showDefaultImageView() {
showImageView(R.id.imageShow).setShowControls(false);
- mMasterImage.setCurrentFilter(null);
- mMasterImage.setCurrentFilterRepresentation(null);
+ MasterImage.getImage().setCurrentFilter(null);
+ MasterImage.getImage().setCurrentFilterRepresentation(null);
}
public void showPanel(View view) {
@@ -403,7 +401,7 @@ public class PanelController implements OnClickListener {
}
public ImagePreset getImagePreset() {
- return mMasterImage.getPreset();
+ return MasterImage.getImage().getPreset();
}
/**
@@ -453,9 +451,9 @@ public class PanelController implements OnClickListener {
boolean doPanelTransition = true;
if (view instanceof FilterIconButton) {
- ImageFilter f = ((FilterIconButton) view).getImageFilter();
+ FilterRepresentation f = ((FilterIconButton) view).getFilterRepresentation();
if (f != null) {
- // FIXME: this check shouldn't be necessary
+ // FIXME: this check shouldn't be necessary (f shouldn't be null)
doPanelTransition = f.showUtilityPanel();
}
}
@@ -479,21 +477,23 @@ public class PanelController implements OnClickListener {
mCurrentEditor = null;
FilterIconButton component = (FilterIconButton) view;
ImageFilter filter = component.getImageFilter();
- if (filter != null && filter.getEditingViewId() != 0) {
- if (mEditorPlaceHolder.contains(filter.getEditingViewId())) {
- mCurrentEditor = mEditorPlaceHolder.showEditor(filter.getEditingViewId());
- mCurrentImage = mCurrentEditor.getImageShow();
- mCurrentEditor.setPanelController(this);
- } else {
- mCurrentImage = showImageView(filter.getEditingViewId());
- }
- mCurrentImage.setShowControls(filter.showEditingControls());
- if (filter.getTextId() != 0) {
- String ename = mCurrentImage.getContext().getString(filter.getTextId());
- mUtilityPanel.setEffectName(ename);
+ FilterRepresentation representation = component.getFilterRepresentation();
+ if (representation != null) {
+ mUtilityPanel.setEffectName(representation.getName());
+ mUtilityPanel.setShowParameter(representation.showParameterValue());
+
+ if (representation.getEditorId() != 0) {
+ if (mEditorPlaceHolder.contains(representation.getEditorId())) {
+ mCurrentEditor = mEditorPlaceHolder.showEditor(representation.getEditorId());
+ mCurrentImage = mCurrentEditor.getImageShow();
+ mCurrentEditor.setPanelController(this);
+ } else {
+ mCurrentImage = showImageView(representation.getEditorId());
+ }
}
+ mCurrentImage.setShowControls(representation.showEditingControls());
+ mUtilityPanel.setShowParameter(representation.showParameterValue());
- mUtilityPanel.setShowParameter(filter.showParameterValue());
mCurrentImage.select();
if (mCurrentEditor != null) {
mCurrentEditor.reflectCurrentFilter();
@@ -558,7 +558,7 @@ public class PanelController implements OnClickListener {
break;
}
case R.id.applyEffect: {
- if (mMasterImage.getCurrentFilter() instanceof ImageFilterTinyPlanet) {
+ if (MasterImage.getImage().getCurrentFilter() instanceof ImageFilterTinyPlanet) {
mActivity.saveImage();
} else {
if (mCurrentImage instanceof ImageCrop) {
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterColorBorderRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterColorBorderRepresentation.java
index 0c0791a..b2664a3 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;
@@ -28,6 +31,11 @@ public class FilterColorBorderRepresentation extends FilterRepresentation {
mBorderRadius = radius;
setFilterClass(ImageFilterParametricBorder.class);
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 5234023..6c83170 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 1cb2645..b8fa0a3 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 com.android.gallery3d.R;
+import com.android.gallery3d.filtershow.editors.EditorDraw;
import java.util.Vector;
@@ -45,6 +47,11 @@ public class FilterDrawRepresentation extends FilterRepresentation {
public FilterDrawRepresentation() {
super("Draw");
+ setFilterClass(ImageFilterDraw.class);
+ setFilterType(FilterRepresentation.TYPE_VIGNETTE);
+ setTextId(R.string.imageDraw);
+ setButtonId(R.id.drawOnImageButton);
+ setEditorId(EditorDraw.ID);
}
@Override
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java
index 1234767..fa3fe72 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;
@@ -32,6 +32,11 @@ public class FilterFxRepresentation extends FilterRepresentation {
mNameResource = nameResource;
setFilterClass(ImageFilterFx.class);
setFilterType(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 7c9f58f..99c8091 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterImageBorderRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterImageBorderRepresentation.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 FilterImageBorderRepresentation extends FilterRepresentation {
private int mDrawableResource = 0;
@@ -24,6 +27,11 @@ public class FilterImageBorderRepresentation extends FilterRepresentation {
mDrawableResource = drawableResource;
setFilterClass(ImageFilterBorder.class);
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());
@@ -64,6 +72,11 @@ public class FilterImageBorderRepresentation extends FilterRepresentation {
return false;
}
+ @Override
+ public int getTextId() {
+ return R.string.borders;
+ }
+
public boolean allowsMultipleInstances() {
return true;
}
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java
index 7d162f0..f282d29 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java
@@ -17,17 +17,22 @@
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 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;
@@ -47,6 +52,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;
}
@@ -58,7 +70,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;
@@ -103,14 +121,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;
}
@@ -129,4 +139,60 @@ 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;
+ }
}
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterTinyPlanetRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterTinyPlanetRepresentation.java
index 640a57f..9bf2f0b 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterTinyPlanetRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterTinyPlanetRepresentation.java
@@ -16,7 +16,8 @@
package com.android.gallery3d.filtershow.filters;
-import android.util.Log;
+import com.android.gallery3d.R;
+import com.android.gallery3d.filtershow.editors.EditorTinyPlanet;
public class FilterTinyPlanetRepresentation extends FilterBasicRepresentation {
private static final String LOGTAG = "FilterTinyPlanetRepresentation";
@@ -25,6 +26,11 @@ public class FilterTinyPlanetRepresentation extends FilterBasicRepresentation {
public FilterTinyPlanetRepresentation() {
super("TinyPlanet", 0, 50, 100);
setShowParameterValue(true);
+ setFilterClass(ImageFilterTinyPlanet.class);
+ setFilterType(FilterRepresentation.TYPE_TINYPLANET);
+ setTextId(R.string.tinyplanet);
+ setButtonId(R.id.tinyplanetButton);
+ setEditorId(EditorTinyPlanet.ID);
}
@Override
@@ -51,4 +57,9 @@ public class FilterTinyPlanetRepresentation extends FilterBasicRepresentation {
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/filters/ImageFilter.java b/src/com/android/gallery3d/filtershow/filters/ImageFilter.java
index 9ee6241..d7a76d6 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilter.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilter.java
@@ -29,34 +29,6 @@ public class ImageFilter implements Cloneable {
protected String mName = "Original";
private final String LOGTAG = "ImageFilter";
- public int getButtonId() {
- return 0;
- }
-
- public int getTextId() {
- return 0;
- }
-
- public int getOverlayBitmaps() {
- return 0;
- }
-
- public int getEditingViewId() {
- return BasicEditor.ID;
- }
-
- public boolean showEditingControls() {
- return true;
- }
-
- public boolean showParameterValue() {
- return true;
- }
-
- public boolean showUtilityPanel() {
- return true;
- }
-
public void setName(String name) {
mName = name;
}
@@ -92,7 +64,4 @@ public class ImageFilter implements Cloneable {
return null;
}
- public boolean hasDefaultRepresentation() {
- return false;
- }
}
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterBorder.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterBorder.java
index 16e491b..0f1e8d6 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterBorder.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterBorder.java
@@ -50,32 +50,6 @@ public class ImageFilterBorder extends ImageFilter {
return mParameters;
}
- @Override
- public int getTextId() {
- return R.string.borders;
- }
-
- @Override
- public int getEditingViewId() {
- return ImageOnlyEditor.ID;
- }
-
- @Override
-
- public boolean showParameterValue() {
- return false;
- }
-
- @Override
- public boolean showEditingControls() {
- return false;
- }
-
- @Override
- public boolean showUtilityPanel() {
- return false;
- }
-
public Bitmap applyHelper(Bitmap bitmap, float scale1, float scale2 ) {
int w = bitmap.getWidth();
int h = bitmap.getHeight();
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterBwFilter.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterBwFilter.java
index 6a0d4c7..3580dd6 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterBwFilter.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterBwFilter.java
@@ -34,19 +34,11 @@ public class ImageFilterBwFilter extends SimpleImageFilter {
representation.setFilterClass(ImageFilterBwFilter.class);
representation.setMaximum(180);
representation.setMinimum(-180);
+ representation.setTextId(R.string.bwfilter);
+ representation.setButtonId(R.id.bwfilterButton);
return representation;
}
- @Override
- public int getButtonId() {
- return R.id.bwfilterButton;
- }
-
- @Override
- public int getTextId() {
- return R.string.bwfilter;
- }
-
native protected void nativeApplyFilter(Bitmap bitmap, int w, int h, int r, int g, int b);
@Override
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterContrast.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterContrast.java
index 7e78589..e266426 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterContrast.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterContrast.java
@@ -30,19 +30,11 @@ public class ImageFilterContrast extends SimpleImageFilter {
FilterRepresentation representation = super.getDefaultRepresentation();
representation.setName("Contrast");
representation.setFilterClass(ImageFilterContrast.class);
+ representation.setTextId(R.string.contrast);
+ representation.setButtonId(R.id.contrastButton);
return representation;
}
- @Override
- public int getButtonId() {
- return R.id.contrastButton;
- }
-
- @Override
- public int getTextId() {
- return R.string.contrast;
- }
-
native protected void nativeApplyFilter(Bitmap bitmap, int w, int h, float strength);
@Override
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterCurves.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterCurves.java
index 7c160b3..4b65a00 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterCurves.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterCurves.java
@@ -28,16 +28,8 @@ public class ImageFilterCurves extends ImageFilter {
FilterCurvesRepresentation mParameters = new FilterCurvesRepresentation();
@Override
- public boolean hasDefaultRepresentation() {
- return true;
- }
-
- @Override
public FilterRepresentation getDefaultRepresentation() {
- FilterCurvesRepresentation representation = new FilterCurvesRepresentation();
- representation.setName("Draw");
- representation.setFilterClass(ImageFilterCurves.class);
- return representation;
+ return new FilterCurvesRepresentation();
}
@Override
@@ -51,31 +43,6 @@ public class ImageFilterCurves extends ImageFilter {
reset();
}
- @Override
- public int getButtonId() {
- return R.id.curvesButtonRGB;
- }
-
- @Override
- public int getTextId() {
- return R.string.curvesRGB;
- }
-
- @Override
- public int getOverlayBitmaps() {
- return R.drawable.filtershow_button_colors_curve;
- }
-
- @Override
- public int getEditingViewId() {
- return R.id.imageCurves;
- }
-
- @Override
- public boolean showParameterValue() {
- return false;
- }
-
public void populateArray(int[] array, int curveIndex) {
Spline spline = mParameters.getSpline(curveIndex);
if (spline == null) {
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterDownsample.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterDownsample.java
index c2b6481..a53d2f3 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterDownsample.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterDownsample.java
@@ -41,20 +41,12 @@ public class ImageFilterDownsample extends SimpleImageFilter {
representation.setValue(50);
representation.setDefaultValue(50);
representation.setPreviewValue(3);
+ representation.setTextId(R.string.downsample);
+ representation.setButtonId(R.id.downsampleButton);
return representation;
}
@Override
- public int getButtonId() {
- return R.id.downsampleButton;
- }
-
- @Override
- public int getTextId() {
- return R.string.downsample;
- }
-
- @Override
public Bitmap apply(Bitmap bitmap, float scaleFactor, boolean highQuality) {
if (getParameters() == null) {
return bitmap;
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterDraw.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterDraw.java
index c1535fe..ed02c1d 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterDraw.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterDraw.java
@@ -62,17 +62,8 @@ public class ImageFilterDraw extends ImageFilter {
}
@Override
- public boolean hasDefaultRepresentation() {
- return true;
- }
-
- @Override
public FilterRepresentation getDefaultRepresentation() {
- FilterDrawRepresentation representation = new FilterDrawRepresentation();
- representation.setName("Draw");
- representation.setFilterClass(ImageFilterDraw.class);
- representation.setFilterType(FilterRepresentation.TYPE_VIGNETTE);
- return representation;
+ return new FilterDrawRepresentation();
}
@Override
@@ -246,25 +237,6 @@ public class ImageFilterDraw extends ImageFilter {
mCachedStrokes = n;
}
- @Override
- public int getButtonId() {
- return R.id.drawOnImageButton;
- }
-
- @Override
- public int getTextId() {
- return R.string.imageDraw;
- }
-
- @Override
- public int getEditingViewId() {
- return EditorDraw.ID;
- }
-
- public boolean isNil() {
- return mParameters.getDrawing().isEmpty();
- }
-
public void draw(Canvas canvas, Matrix originalRotateToScreen) {
for (FilterDrawRepresentation.StrokeData strokeData : mParameters.getDrawing()) {
paint(strokeData, canvas, originalRotateToScreen, false);
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterEdge.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterEdge.java
index f5a0a69..96839e4 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterEdge.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterEdge.java
@@ -30,22 +30,14 @@ public class ImageFilterEdge extends SimpleImageFilter {
FilterRepresentation representation = super.getDefaultRepresentation();
representation.setName("Edge");
representation.setFilterClass(ImageFilterEdge.class);
+ representation.setTextId(R.string.edge);
+ representation.setButtonId(R.id.edgeButton);
return representation;
}
native protected void nativeApplyFilter(Bitmap bitmap, int w, int h, float p);
@Override
- public int getButtonId() {
- return R.id.edgeButton;
- }
-
- @Override
- public int getTextId() {
- return R.string.edge;
- }
-
- @Override
public Bitmap apply(Bitmap bitmap, float scaleFactor, boolean highQuality) {
if (getParameters() == null) {
return bitmap;
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterExposure.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterExposure.java
index 569a6f2..e36f096 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterExposure.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterExposure.java
@@ -30,19 +30,11 @@ public class ImageFilterExposure extends SimpleImageFilter {
FilterRepresentation representation = super.getDefaultRepresentation();
representation.setName("Exposure");
representation.setFilterClass(ImageFilterExposure.class);
+ representation.setTextId(R.string.exposure);
+ representation.setButtonId(R.id.exposureButton);
return representation;
}
- @Override
- public int getButtonId() {
- return R.id.exposureButton;
- }
-
- @Override
- public int getTextId() {
- return R.string.exposure;
- }
-
native protected void nativeApplyFilter(Bitmap bitmap, int w, int h, float bright);
@Override
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterFx.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterFx.java
index df5ec47..0a3c8ab 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterFx.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterFx.java
@@ -26,7 +26,6 @@ public class ImageFilterFx extends ImageFilter {
private FilterFxRepresentation mParameters = null;
public ImageFilterFx() {
-
}
public void useRepresentation(FilterRepresentation representation) {
@@ -38,34 +37,6 @@ public class ImageFilterFx extends ImageFilter {
return mParameters;
}
- @Override
- public int getTextId() {
- if (getParameters() == null) {
- return 0;
- }
- return getParameters().getNameResource();
- }
-
- @Override
- public int getEditingViewId() {
- return ImageOnlyEditor.ID;
- }
-
- @Override
- public boolean showParameterValue() {
- return false;
- }
-
- @Override
- public boolean showEditingControls() {
- return false;
- }
-
- @Override
- public boolean showUtilityPanel() {
- return false;
- }
-
native protected void nativeApplyFilter(Bitmap bitmap, int w, int h,Bitmap fxBitmap, int fxw, int fxh);
@Override
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterGradient.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterGradient.java
deleted file mode 100644
index a0b733a..0000000
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterGradient.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * 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.Bitmap;
-import android.graphics.Bitmap.Config;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.LinearGradient;
-import android.graphics.Paint;
-import android.graphics.Paint.Style;
-import android.graphics.Shader.TileMode;
-
-public class ImageFilterGradient extends ImageFilter {
-
- private Bitmap mGradientBitmap = null;
- private int[] mColors = null;
- private float[] mPositions = null;
-
- public ImageFilterGradient() {
- mName = "Gradient";
- }
-
- @Override
- public ImageFilter clone() throws CloneNotSupportedException {
- // FIXME: clone() should not be needed. Remove?.
- ImageFilterGradient filter = (ImageFilterGradient) super.clone();
- System.arraycopy(mColors, 0, filter.mColors, 0, mColors.length);
- System.arraycopy(mPositions, 0, filter.mPositions, 0, mPositions.length);
- return filter;
- }
-
- public void addColor(int color, float position) {
- int length = 0;
- if (mColors != null) {
- length = mColors.length;
- }
- int[] colors = new int[length + 1];
- float[] positions = new float[length + 1];
-
- for (int i = 0; i < length; i++) {
- colors[i] = mColors[i];
- positions[i] = mPositions[i];
- }
-
- colors[length] = color;
- positions[length] = position;
-
- mColors = colors;
- mPositions = positions;
- }
-
- @Override
- public Bitmap apply(Bitmap bitmap, float scaleFactor, boolean highQuality) {
- createGradient();
- int[] gradient = new int[256];
- int[] redGradient = new int[256];
- int[] greenGradient = new int[256];
- int[] blueGradient = new int[256];
- mGradientBitmap.getPixels(gradient, 0, 256, 0, 0, 256, 1);
-
- for (int i = 0; i < 256; i++) {
- redGradient[i] = Color.red(gradient[i]);
- greenGradient[i] = Color.green(gradient[i]);
- blueGradient[i] = Color.blue(gradient[i]);
- }
- nativeApplyGradientFilter(bitmap, bitmap.getWidth(), bitmap.getHeight(),
- redGradient, greenGradient, blueGradient);
- return bitmap;
- }
-
- public void createGradient() {
- if (mGradientBitmap != null) {
- return;
- }
-
- /* Create a 200 x 200 bitmap and fill it with black. */
- Bitmap b = Bitmap.createBitmap(256, 1, Config.ARGB_8888);
- Canvas c = new Canvas(b);
- c.drawColor(Color.BLACK);
-
- /* Create your gradient. */
-
- /*
- * int[] colors = new int[2]; colors[0] = Color.argb(255, 20, 20, 10);
- * colors[0] = Color.BLACK; colors[1] = Color.argb(255, 228, 231, 193);
- * float[] positions = new float[2]; positions[0] = 0; positions[1] = 1;
- */
-
- LinearGradient grad = new LinearGradient(0, 0, 255, 1, mColors,
- mPositions, TileMode.CLAMP);
-
- /* Draw your gradient to the top of your bitmap. */
- Paint p = new Paint();
- p.setStyle(Style.FILL);
- p.setShader(grad);
- c.drawRect(0, 0, 256, 1, p);
- mGradientBitmap = b;
- }
-
-}
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterHue.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterHue.java
index f6cd220..ed28e57 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterHue.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterHue.java
@@ -35,24 +35,12 @@ public class ImageFilterHue extends SimpleImageFilter {
representation.setFilterClass(ImageFilterHue.class);
representation.setMinimum(-180);
representation.setMaximum(180);
+ representation.setTextId(R.string.hue);
+ representation.setButtonId(R.id.hueButton);
+ representation.setEditorId(BasicEditor.ID);
return representation;
}
- @Override
- public int getButtonId() {
- return R.id.hueButton;
- }
-
- @Override
- public int getTextId() {
- return R.string.hue;
- }
-
- @Override
- public int getEditingViewId() {
- return BasicEditor.ID;
- }
-
native protected void nativeApplyFilter(Bitmap bitmap, int w, int h, float []matrix);
@Override
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterKMeans.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterKMeans.java
index fd098e6..f288397 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterKMeans.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterKMeans.java
@@ -43,6 +43,8 @@ public class ImageFilterKMeans extends SimpleImageFilter {
representation.setValue(4);
representation.setDefaultValue(4);
representation.setPreviewValue(4);
+ representation.setTextId(R.string.kmeans);
+ representation.setButtonId(R.id.kmeansButton);
return representation;
}
@@ -51,16 +53,6 @@ public class ImageFilterKMeans extends SimpleImageFilter {
int swidth, int sheight, int p, int seed);
@Override
- public int getButtonId() {
- return R.id.kmeansButton;
- }
-
- @Override
- public int getTextId() {
- return R.string.kmeans;
- }
-
- @Override
public Bitmap apply(Bitmap bitmap, float scaleFactor, boolean highQuality) {
if (getParameters() == null) {
return bitmap;
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterNegative.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterNegative.java
index e69fe35..14307c3 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterNegative.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterNegative.java
@@ -13,33 +13,13 @@ public class ImageFilterNegative extends ImageFilter {
public FilterRepresentation getDefaultRepresentation() {
FilterRepresentation representation = new FilterDirectRepresentation("Negative");
representation.setFilterClass(ImageFilterNegative.class);
+ representation.setTextId(R.string.negative);
+ representation.setButtonId(R.id.negativeButton);
+ representation.setShowEditingControls(false);
+ representation.setShowParameterValue(false);
return representation;
}
- public boolean hasDefaultRepresentation() {
- return true;
- }
-
- @Override
- public int getButtonId() {
- return R.id.negativeButton;
- }
-
- @Override
- public int getTextId() {
- return R.string.negative;
- }
-
- @Override
- public boolean showEditingControls() {
- return false;
- }
-
- @Override
- public boolean showParameterValue() {
- return false;
- }
-
native protected void nativeApplyFilter(Bitmap bitmap, int w, int h);
@Override
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterParametricBorder.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterParametricBorder.java
index 4c185b5..36c86d8 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterParametricBorder.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterParametricBorder.java
@@ -41,26 +41,6 @@ public class ImageFilterParametricBorder extends ImageFilter {
return mParameters;
}
- @Override
- public int getTextId() {
- return R.string.borders;
- }
-
- @Override
- public boolean showParameterValue() {
- return false;
- }
-
- @Override
- public boolean showEditingControls() {
- return false;
- }
-
- @Override
- public boolean showUtilityPanel() {
- return false;
- }
-
private void applyHelper(Canvas canvas, int w, int h) {
if (getParameters() == null) {
return;
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterRedEye.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterRedEye.java
index ee3a19c..832f644 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterRedEye.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterRedEye.java
@@ -33,17 +33,14 @@ public class ImageFilterRedEye extends ImageFilter {
mName = "Red Eye";
}
- @Override
public int getButtonId() {
return R.id.redEyeButton;
}
- @Override
public int getTextId() {
return R.string.redeye;
}
- @Override
public int getEditingViewId() {
return R.id.imageRedEyes;
}
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterSaturated.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterSaturated.java
index 7d848f5..747a036 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterSaturated.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterSaturated.java
@@ -30,19 +30,11 @@ public class ImageFilterSaturated extends SimpleImageFilter {
FilterRepresentation representation = super.getDefaultRepresentation();
representation.setName("Saturated");
representation.setFilterClass(ImageFilterSaturated.class);
+ representation.setTextId(R.string.saturation);
+ representation.setButtonId(R.id.saturationButton);
return representation;
}
- @Override
- public int getButtonId() {
- return R.id.saturationButton;
- }
-
- @Override
- public int getTextId() {
- return R.string.saturation;
- }
-
native protected void nativeApplyFilter(Bitmap bitmap, int w, int h, float saturation);
@Override
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterShadows.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterShadows.java
index c39580f..a2560b9 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterShadows.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterShadows.java
@@ -31,19 +31,11 @@ public class ImageFilterShadows extends SimpleImageFilter {
FilterRepresentation representation = super.getDefaultRepresentation();
representation.setName("Shadows");
representation.setFilterClass(ImageFilterShadows.class);
+ representation.setTextId(R.string.shadow_recovery);
+ representation.setButtonId(R.id.shadowRecoveryButton);
return representation;
}
- @Override
- public int getButtonId() {
- return R.id.shadowRecoveryButton;
- }
-
- @Override
- public int getTextId() {
- return R.string.shadow_recovery;
- }
-
native protected void nativeApplyFilter(Bitmap bitmap, int w, int h, float factor);
@Override
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterSharpen.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterSharpen.java
index 58c2ac6..92f9b1a 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterSharpen.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterSharpen.java
@@ -34,6 +34,10 @@ public class ImageFilterSharpen extends ImageFilterRS {
FilterRepresentation representation = new FilterBasicRepresentation("Sharpen", 0, 0, 100);
representation.setShowParameterValue(true);
representation.setFilterClass(ImageFilterSharpen.class);
+ representation.setTextId(R.string.sharpness);
+ representation.setButtonId(R.id.sharpenButton);
+ representation.setOverlayId(R.drawable.filtershow_button_colors_sharpen);
+ representation.setEditorId(R.id.imageZoom);
return representation;
}
@@ -42,30 +46,6 @@ public class ImageFilterSharpen extends ImageFilterRS {
mParameters = parameters;
}
- public boolean hasDefaultRepresentation() {
- return true;
- }
-
- @Override
- public int getButtonId() {
- return R.id.sharpenButton;
- }
-
- @Override
- public int getTextId() {
- return R.string.sharpness;
- }
-
- @Override
- public int getOverlayBitmaps() {
- return R.drawable.filtershow_button_colors_sharpen;
- }
-
- @Override
- public int getEditingViewId() {
- return R.id.imageZoom;
- }
-
@Override
public void createFilter(android.content.res.Resources res, float scaleFactor,
boolean highQuality) {
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterTinyPlanet.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterTinyPlanet.java
index 535a39d1..d8ec390 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterTinyPlanet.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterTinyPlanet.java
@@ -57,16 +57,6 @@ public class ImageFilterTinyPlanet extends SimpleImageFilter {
}
@Override
- public int getEditingViewId() {
- return EditorTinyPlanet.ID;
- }
-
- @Override
- public boolean hasDefaultRepresentation() {
- return true;
- }
-
- @Override
public void useRepresentation(FilterRepresentation representation) {
FilterTinyPlanetRepresentation parameters = (FilterTinyPlanetRepresentation) representation;
mParameters = parameters;
@@ -74,26 +64,7 @@ public class ImageFilterTinyPlanet extends SimpleImageFilter {
@Override
public FilterRepresentation getDefaultRepresentation() {
- FilterTinyPlanetRepresentation representation = new FilterTinyPlanetRepresentation();
- representation.setName("TinyPlanet");
- representation.setFilterClass(ImageFilterTinyPlanet.class);
- representation.setFilterType(FilterRepresentation.TYPE_TINYPLANET);
- return representation;
- }
-
- @Override
- public int getButtonId() {
- return R.id.tinyplanetButton;
- }
-
- @Override
- public int getTextId() {
- return R.string.tinyplanet;
- }
-
- public boolean isNil() {
- // TinyPlanet always has an effect
- return false;
+ return new FilterTinyPlanetRepresentation();
}
native protected void nativeApplyFilter(
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterVibrance.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterVibrance.java
index 905850a..3859211 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterVibrance.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterVibrance.java
@@ -30,19 +30,11 @@ public class ImageFilterVibrance extends SimpleImageFilter {
FilterRepresentation representation = super.getDefaultRepresentation();
representation.setName("Vibrance");
representation.setFilterClass(ImageFilterVibrance.class);
+ representation.setTextId(R.string.vibrance);
+ representation.setButtonId(R.id.vibranceButton);
return representation;
}
- @Override
- public int getButtonId() {
- return R.id.vibranceButton;
- }
-
- @Override
- public int getTextId() {
- return R.string.vibrance;
- }
-
native protected void nativeApplyFilter(Bitmap bitmap, int w, int h, float bright);
@Override
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterVignette.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterVignette.java
index b14ee55..3aad6bd 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterVignette.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterVignette.java
@@ -34,19 +34,11 @@ public class ImageFilterVignette extends SimpleImageFilter {
representation.setName("Vignette");
representation.setFilterClass(ImageFilterVignette.class);
representation.setPriority(FilterRepresentation.TYPE_VIGNETTE);
+ representation.setTextId(R.string.vignette);
+ representation.setButtonId(R.id.vignetteButton);
return representation;
}
- @Override
- public int getButtonId() {
- return R.id.vignetteButton;
- }
-
- @Override
- public int getTextId() {
- return R.string.vignette;
- }
-
native protected void nativeApplyFilter(Bitmap bitmap, int w, int h, float strength);
@Override
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterWBalance.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterWBalance.java
index 8b6c87b..28223b2 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterWBalance.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterWBalance.java
@@ -31,27 +31,12 @@ public class ImageFilterWBalance extends ImageFilter {
FilterRepresentation representation = new FilterDirectRepresentation("WBalance");
representation.setFilterClass(ImageFilterWBalance.class);
representation.setFilterType(FilterRepresentation.TYPE_WBALANCE);
+ representation.setTextId(R.string.wbalance);
+ representation.setButtonId(R.id.wbalanceButton);
+ representation.setShowEditingControls(false);
return representation;
}
- public boolean hasDefaultRepresentation() {
- return true;
- }
-
- @Override
- public int getButtonId() {
- return R.id.wbalanceButton;
- }
-
- @Override
- public int getTextId() {
- return R.string.wbalance;
- }
-
- public boolean showEditingControls() {
- return false;
- }
-
native protected void nativeApplyFilter(Bitmap bitmap, int w, int h, int locX, int locY);
@Override
diff --git a/src/com/android/gallery3d/filtershow/filters/SimpleImageFilter.java b/src/com/android/gallery3d/filtershow/filters/SimpleImageFilter.java
index 8b6f3da..d494913 100644
--- a/src/com/android/gallery3d/filtershow/filters/SimpleImageFilter.java
+++ b/src/com/android/gallery3d/filtershow/filters/SimpleImageFilter.java
@@ -33,10 +33,6 @@ public class SimpleImageFilter extends ImageFilter {
mParameters = parameters;
}
- public boolean hasDefaultRepresentation() {
- return true;
- }
-
public FilterBasicRepresentation getParameters() {
return mParameters;
}
diff --git a/src/com/android/gallery3d/filtershow/ui/FilterIconButton.java b/src/com/android/gallery3d/filtershow/ui/FilterIconButton.java
index b78ab03..681574c 100644
--- a/src/com/android/gallery3d/filtershow/ui/FilterIconButton.java
+++ b/src/com/android/gallery3d/filtershow/ui/FilterIconButton.java
@@ -62,10 +62,6 @@ public class FilterIconButton extends IconButton implements View.OnClickListener
LinearLayout parent) {
setup(text, controller, parent);
mImageFilter = filter;
- if (mImageFilter.getOverlayBitmaps() != 0) {
- mOverlayBitmap = BitmapFactory.decodeResource(getResources(),
- mImageFilter.getOverlayBitmaps());
- }
}
@Override
@@ -107,7 +103,15 @@ public class FilterIconButton extends IconButton implements View.OnClickListener
return mImageFilter;
}
+ public FilterRepresentation getFilterRepresentation() {
+ return mFilterRepresentation;
+ }
+
public void setFilterRepresentation(FilterRepresentation filterRepresentation) {
mFilterRepresentation = filterRepresentation;
+ if (mFilterRepresentation != null && mFilterRepresentation.getOverlayId() != 0) {
+ mOverlayBitmap = BitmapFactory.decodeResource(getResources(),
+ mFilterRepresentation.getOverlayId());
+ }
}
}
diff --git a/src_pd/com/android/gallery3d/filtershow/filters/FiltersManager.java b/src_pd/com/android/gallery3d/filtershow/filters/FiltersManager.java
index 3a259e9..5ddabe2 100644
--- a/src_pd/com/android/gallery3d/filtershow/filters/FiltersManager.java
+++ b/src_pd/com/android/gallery3d/filtershow/filters/FiltersManager.java
@@ -57,6 +57,33 @@ 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(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 ImageFilterWBalance());