summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow/filters/ImageFilterExposure.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
commit71f04cbaedbb89e313e0b86b531640db2d3f6016 (patch)
tree60ef6e25872e177dd50044184c84ee681af07d21 /src/com/android/gallery3d/filtershow/filters/ImageFilterExposure.java
parenta93d583970819f2bea4b12f1233655fb9ede3387 (diff)
downloadandroid_packages_apps_Gallery2-71f04cbaedbb89e313e0b86b531640db2d3f6016.tar.gz
android_packages_apps_Gallery2-71f04cbaedbb89e313e0b86b531640db2d3f6016.tar.bz2
android_packages_apps_Gallery2-71f04cbaedbb89e313e0b86b531640db2d3f6016.zip
Refactor filters parameters
- introduce FilterRepresentations - change filters lifecycle Change-Id: I9416fca47a334d532a347cd5577795738c870933
Diffstat (limited to 'src/com/android/gallery3d/filtershow/filters/ImageFilterExposure.java')
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterExposure.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterExposure.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterExposure.java
index 63f860171..569a6f276 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterExposure.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterExposure.java
@@ -20,12 +20,19 @@ import com.android.gallery3d.R;
import android.graphics.Bitmap;
-public class ImageFilterExposure extends ImageFilter {
+public class ImageFilterExposure extends SimpleImageFilter {
public ImageFilterExposure() {
mName = "Exposure";
}
+ public FilterRepresentation getDefaultRepresentation() {
+ FilterRepresentation representation = super.getDefaultRepresentation();
+ representation.setName("Exposure");
+ representation.setFilterClass(ImageFilterExposure.class);
+ return representation;
+ }
+
@Override
public int getButtonId() {
return R.id.exposureButton;
@@ -40,10 +47,12 @@ public class ImageFilterExposure 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();
- int p = mParameter;
- float value = p;
+ float value = getParameters().getValue();
nativeApplyFilter(bitmap, w, h, value);
return bitmap;
}