copy.add(vignette);
copy.setHistoryName(vignette.name());
copy.setIsFx(false);
+ filter = copy.getFilter("Vignette");
mImageShow.setImagePreset(copy);
+ mImageShow.setCurrentFilter(filter);
}
unselectPanelButtons(mColorsPanelButtons);
mVignetteButton.setSelected(true);
unselectPanelButtons(mColorsPanelButtons);
mSharpenButton.setSelected(true);
mImageShow.showToast("Sharpen", true);
+ mImageShow.setCurrentFilter(null);
}
};
}
unselectPanelButtons(mColorsPanelButtons);
mContrastButton.setSelected(true);
mImageShow.showToast("Contrast", true);
+ mImageShow.setCurrentFilter(null);
}
};
}
public class ImageFilter {
- protected int mParameter = 50;
+ protected int mParameter = 0;
public String name() {
return "Original";
import com.android.gallery3d.filtershow.FilterShowActivity;
import com.android.gallery3d.filtershow.HistoryAdapter;
import com.android.gallery3d.filtershow.cache.ImageLoader;
+import com.android.gallery3d.filtershow.filters.ImageFilter;
import com.android.gallery3d.filtershow.presets.ImagePreset;
import com.android.gallery3d.filtershow.ui.SliderListener;
import com.android.gallery3d.filtershow.ui.SliderController;
protected ImagePreset mImagePreset = null;
protected ImageLoader mImageLoader = null;
+ private ImageFilter mCurrentFilter = null;
private Bitmap mBackgroundImage = null;
protected Bitmap mForegroundImage = null;
private Handler mHandler = new Handler();
public void onNewValue(int value) {
- getImagePreset().setParameter(value);
+ if (mCurrentFilter != null) {
+ mCurrentFilter.setParameter(value);
+ }
mImageLoader.resetImageForPreset(getImagePreset(), this);
invalidate();
}
mSliderController.setHeight(parentHeight);
}
+ public void setCurrentFilter(ImageFilter filter) {
+ mCurrentFilter = filter;
+ }
+
public void setAdapter(HistoryAdapter adapter) {
mAdapter = adapter;
}
private static final String LOGTAG = "ImagePreset";
ImageShow mEndPoint = null;
- protected int mParameter = 50;
protected Vector<ImageFilter> mFilters = new Vector<ImageFilter>();
protected String mName = "Original";
protected String mHistoryName = "Original";
return bitmap;
}
- /*
- * public void applyFilter(Bitmap bitmap) { // do nothing here, subclasses
- * will implement filtering here } native protected void
- * nativeApplyGradientFilter(Bitmap bitmap, int w, int h, int[] redGradient,
- * int[] greenGradient, int[] blueGradient);
- */
-
- public void setParameter(int value) {
- mParameter = value;
- for (int i = 0; i < mFilters.size(); i++) {
- ImageFilter filter = mFilters.elementAt(i);
- filter.setParameter(value);
- }
- }
-
-}
+ }