summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow/filters/ImageFilterShadows.java
diff options
context:
space:
mode:
authornicolasroard <nicolasroard@google.com>2013-01-28 16:36:46 -0800
committernicolasroard <nicolasroard@google.com>2013-02-05 00:03:18 -0800
commitda4de5aa86b49be455efe396455b77be44dec684 (patch)
tree4d35214fecb7af9f2f09cd44b4910cf793d2af6d /src/com/android/gallery3d/filtershow/filters/ImageFilterShadows.java
parent465e25bd3cb2c76732102d7be98bc0335962f715 (diff)
downloadandroid_packages_apps_Snap-da4de5aa86b49be455efe396455b77be44dec684.tar.gz
android_packages_apps_Snap-da4de5aa86b49be455efe396455b77be44dec684.tar.bz2
android_packages_apps_Snap-da4de5aa86b49be455efe396455b77be44dec684.zip
Refactor filters parameters
- introduce FilterRepresentations - change filters lifecycle Change-Id: I9416fca47a334d532a347cd5577795738c870933
Diffstat (limited to 'src/com/android/gallery3d/filtershow/filters/ImageFilterShadows.java')
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterShadows.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterShadows.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterShadows.java
index de8fcd5ea..27e5342c9 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterShadows.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterShadows.java
@@ -20,13 +20,20 @@ import com.android.gallery3d.R;
import android.graphics.Bitmap;
-public class ImageFilterShadows extends ImageFilter {
+public class ImageFilterShadows extends SimpleImageFilter {
public ImageFilterShadows() {
mName = "Shadows";
}
+ public FilterRepresentation getDefaultRepresentation() {
+ FilterRepresentation representation = super.getDefaultRepresentation();
+ representation.setName("Shadows");
+ representation.setFilterClass(ImageFilterShadows.class);
+ return representation;
+ }
+
@Override
public int getButtonId() {
return R.id.shadowRecoveryButton;
@@ -47,9 +54,12 @@ public class ImageFilterShadows extends ImageFilter {
@Override
public Bitmap apply(Bitmap bitmap, float scaleFactor, boolean highQuality) {
+ if (getParameters() == null) {
+ return bitmap;
+ }
int w = bitmap.getWidth();
int h = bitmap.getHeight();
- float p = mParameter;
+ float p = getParameters().getValue();
nativeApplyFilter(bitmap, w, h, p);
return bitmap;