diff options
author | nicolasroard <nicolasroard@google.com> | 2013-01-28 16:36:46 -0800 |
---|---|---|
committer | nicolasroard <nicolasroard@google.com> | 2013-02-05 00:03:18 -0800 |
commit | da4de5aa86b49be455efe396455b77be44dec684 (patch) | |
tree | 4d35214fecb7af9f2f09cd44b4910cf793d2af6d /src/com/android/gallery3d/filtershow/filters/SimpleImageFilter.java | |
parent | 465e25bd3cb2c76732102d7be98bc0335962f715 (diff) | |
download | android_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/SimpleImageFilter.java')
-rw-r--r-- | src/com/android/gallery3d/filtershow/filters/SimpleImageFilter.java | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/com/android/gallery3d/filtershow/filters/SimpleImageFilter.java b/src/com/android/gallery3d/filtershow/filters/SimpleImageFilter.java new file mode 100644 index 000000000..8b6f3da5e --- /dev/null +++ b/src/com/android/gallery3d/filtershow/filters/SimpleImageFilter.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2013 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; + +public class SimpleImageFilter extends ImageFilter { + + private FilterBasicRepresentation mParameters; + + public FilterRepresentation getDefaultRepresentation() { + FilterRepresentation representation = new FilterBasicRepresentation("Default", 0, 50, 100); + representation.setShowParameterValue(true); + return representation; + } + + public void useRepresentation(FilterRepresentation representation) { + FilterBasicRepresentation parameters = (FilterBasicRepresentation) representation; + mParameters = parameters; + } + + public boolean hasDefaultRepresentation() { + return true; + } + + public FilterBasicRepresentation getParameters() { + return mParameters; + } + + @Override + public Bitmap iconApply(Bitmap bitmap, float scaleFactor, boolean highQuality) { + FilterRepresentation representation = getDefaultRepresentation(); + this.useRepresentation(representation); + return apply(bitmap, scaleFactor, highQuality); + } +} |