summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Hoford <hoford@google.com>2013-04-05 08:48:39 -0700
committerJohn Hoford <hoford@google.com>2013-04-08 08:50:34 -0700
commitca13834b449c4586292ca9cc1853fd8e65884edd (patch)
tree9d169bdd8539313fd5c5787eb49fdb0548c297f9
parentd16187301386ce1234a57fa6da9f805624227570 (diff)
downloadandroid_packages_apps_Snap-ca13834b449c4586292ca9cc1853fd8e65884edd.tar.gz
android_packages_apps_Snap-ca13834b449c4586292ca9cc1853fd8e65884edd.tar.bz2
android_packages_apps_Snap-ca13834b449c4586292ca9cc1853fd8e65884edd.zip
support for simplified computed icons
Change-Id: Id886a0a2151037420d3672f34d2838c5d9c69cbd
-rw-r--r--src/com/android/gallery3d/filtershow/filters/IconUtilities.java74
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilter.java2
2 files changed, 75 insertions, 1 deletions
diff --git a/src/com/android/gallery3d/filtershow/filters/IconUtilities.java b/src/com/android/gallery3d/filtershow/filters/IconUtilities.java
new file mode 100644
index 000000000..38211f3c9
--- /dev/null
+++ b/src/com/android/gallery3d/filtershow/filters/IconUtilities.java
@@ -0,0 +1,74 @@
+/*
+ * 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.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+
+import com.android.gallery3d.R;
+
+public class IconUtilities {
+ public static final int PUNCH = R.drawable.filtershow_fx_0005_punch;
+ public static final int VINTAGE = R.drawable.filtershow_fx_0000_vintage;
+ public static final int BW_CONTRAST = R.drawable.filtershow_fx_0004_bw_contrast;
+ public static final int BLEACH = R.drawable.filtershow_fx_0002_bleach;
+ public static final int INSTANT = R.drawable.filtershow_fx_0001_instant;
+ public static final int WASHOUT = R.drawable.filtershow_fx_0007_washout;
+ public static final int BLUECRUSH = R.drawable.filtershow_fx_0003_blue_crush;
+ public static final int WASHOUT_COLOR = R.drawable.filtershow_fx_0008_washout_color;
+ public static final int X_PROCESS = R.drawable.filtershow_fx_0006_x_process;
+
+ public static Bitmap getFXBitmap(Resources res, int id) {
+ Bitmap ret;
+ BitmapFactory.Options o = new BitmapFactory.Options();
+ o.inScaled = false;
+
+ if (id != 0) {
+ return BitmapFactory.decodeResource(res, id, o);
+ }
+ return null;
+ }
+
+ public static Bitmap loadBitmap(Resources res, int resource) {
+
+ final BitmapFactory.Options options = new BitmapFactory.Options();
+ options.inPreferredConfig = Bitmap.Config.ARGB_8888;
+ Bitmap bitmap = BitmapFactory.decodeResource(
+ res,
+ resource, options);
+
+ return bitmap;
+ }
+
+ public static Bitmap applyFX(Bitmap bitmap, final Bitmap fxBitmap) {
+ ImageFilterFx fx = new ImageFilterFx() {
+ @Override
+ public Bitmap apply(Bitmap bitmap, float scaleFactor, int quality) {
+
+ int w = bitmap.getWidth();
+ int h = bitmap.getHeight();
+ int fxw = fxBitmap.getWidth();
+ int fxh = fxBitmap.getHeight();
+
+ nativeApplyFilter(bitmap, w, h, fxBitmap, fxw, fxh);
+ return bitmap;
+ }
+ };
+ return fx.apply(bitmap, 0, 0);
+ }
+}
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilter.java b/src/com/android/gallery3d/filtershow/filters/ImageFilter.java
index 137950c6a..8cdec976b 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilter.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilter.java
@@ -30,7 +30,7 @@ public abstract class ImageFilter implements Cloneable {
protected String mName = "Original";
private final String LOGTAG = "ImageFilter";
-
+ protected static final boolean SIMPLE_ICONS = true;
// TODO: Temporary, for dogfood note memory issues with toasts for better
// feedback. Remove this when filters actually work in low memory
// situations.