summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow/filters/ImageFilterFx.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/gallery3d/filtershow/filters/ImageFilterFx.java')
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterFx.java23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterFx.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterFx.java
index f5dff5ed6..8a50ca960 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterFx.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterFx.java
@@ -22,6 +22,11 @@ public class ImageFilterFx extends ImageFilter {
private static final String TAG = "ImageFilterFx";
Bitmap fxBitmap;
int mNameResource = 0;
+ private FilterFxRepresentation mParameters = null;
+
+ public ImageFilterFx() {
+
+ }
public ImageFilterFx(Bitmap fxBitmap, String name, int nameResource) {
setFilterType(TYPE_FX);
@@ -30,6 +35,15 @@ public class ImageFilterFx extends ImageFilter {
mNameResource = nameResource;
}
+ public void useRepresentation(FilterRepresentation representation) {
+ FilterFxRepresentation parameters = (FilterFxRepresentation) representation;
+ mParameters = parameters;
+ }
+
+ public FilterFxRepresentation getParameters() {
+ return mParameters;
+ }
+
@Override
public int getTextId() {
return mNameResource;
@@ -68,16 +82,17 @@ public class ImageFilterFx extends ImageFilter {
@Override
public Bitmap apply(Bitmap bitmap, float scaleFactor, boolean highQuality) {
- if (fxBitmap==null)
+ if (getParameters() == null || getParameters().getFxBitmap() ==null) {
return bitmap;
+ }
int w = bitmap.getWidth();
int h = bitmap.getHeight();
- int fxw = fxBitmap.getWidth();
- int fxh = fxBitmap.getHeight();
+ int fxw = getParameters().getFxBitmap().getWidth();
+ int fxh = getParameters().getFxBitmap().getHeight();
- nativeApplyFilter(bitmap, w, h, fxBitmap, fxw, fxh);
+ nativeApplyFilter(bitmap, w, h, getParameters().getFxBitmap(), fxw, fxh);
return bitmap;
}
}