aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/cyanogenmod/wallpapers/photophase/effects
diff options
context:
space:
mode:
authorJorge Ruesga <jorge@ruesga.com>2013-08-16 20:52:57 +0200
committerJorge Ruesga <jorge@ruesga.com>2013-08-16 20:52:57 +0200
commite3ee74f67cd53973aec43357c3c4093f5881f6db (patch)
treeb54e7f5391fb07a75a00f4c9c8f51eaef4829d8c /src/org/cyanogenmod/wallpapers/photophase/effects
parent582a5243721eda91cc9d2f7a1d5f00cb6fbf6ec0 (diff)
downloadandroid_packages_wallpapers_PhotoPhase-e3ee74f67cd53973aec43357c3c4093f5881f6db.tar.gz
android_packages_wallpapers_PhotoPhase-e3ee74f67cd53973aec43357c3c4093f5881f6db.tar.bz2
android_packages_wallpapers_PhotoPhase-e3ee74f67cd53973aec43357c3c4093f5881f6db.zip
Add a null effect instead of no apply effect
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Diffstat (limited to 'src/org/cyanogenmod/wallpapers/photophase/effects')
-rw-r--r--src/org/cyanogenmod/wallpapers/photophase/effects/Effects.java9
-rw-r--r--src/org/cyanogenmod/wallpapers/photophase/effects/NullEffect.java54
-rw-r--r--src/org/cyanogenmod/wallpapers/photophase/effects/PhotoPhaseEffectFactory.java9
3 files changed, 71 insertions, 1 deletions
diff --git a/src/org/cyanogenmod/wallpapers/photophase/effects/Effects.java b/src/org/cyanogenmod/wallpapers/photophase/effects/Effects.java
index 665fa49..ef28ee5 100644
--- a/src/org/cyanogenmod/wallpapers/photophase/effects/Effects.java
+++ b/src/org/cyanogenmod/wallpapers/photophase/effects/Effects.java
@@ -37,7 +37,7 @@ public class Effects {
*/
public enum EFFECTS {
/**
- * No effect
+ * @see PhotoPhaseEffectFactory#EFFECT_NULL
*/
NO_EFFECT,
/**
@@ -287,6 +287,13 @@ public class Effects {
effect.setParameter("scale", .5f);
}
}
+
+ // Instead of not to apply any effect, just use one null effect to follow the same
+ // effect model. This allow to use the same height when Effect.apply is applied for all
+ // the frames
+ if (effect == null && EffectFactory.isEffectSupported(PhotoPhaseEffectFactory.EFFECT_NULL)) {
+ effect = effectFactory.createEffect(PhotoPhaseEffectFactory.EFFECT_NULL);
+ }
return effect;
}
}
diff --git a/src/org/cyanogenmod/wallpapers/photophase/effects/NullEffect.java b/src/org/cyanogenmod/wallpapers/photophase/effects/NullEffect.java
new file mode 100644
index 0000000..ca53fe4
--- /dev/null
+++ b/src/org/cyanogenmod/wallpapers/photophase/effects/NullEffect.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2013 The CyanogenMod 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.
+ */
+//
+// Based on the shaders of kodemongki:
+// http://kodemongki.blogspot.com.es/2011/06/kameraku-custom-shader-effects-example.html
+//
+
+package org.cyanogenmod.wallpapers.photophase.effects;
+
+import android.media.effect.EffectContext;
+
+/**
+ * This effect only copies the source texture to the destination texture.<br/>
+ * <table>
+ * <tr><td>Parameter name</td><td>Meaning</td><td>Valid values</td></tr>
+ * </table>
+ */
+public class NullEffect extends PhotoPhaseEffect {
+
+ private static final String FRAGMENT_SHADER =
+ "precision mediump float;\n" +
+ "uniform sampler2D tex_sampler;\n" +
+ "varying vec2 v_texcoord;\n" +
+ "void main(void)\n" +
+ "{\n" +
+ " gl_FragColor = texture2D(tex_sampler, v_texcoord);\n" +
+ "}";
+
+ /**
+ * Constructor of <code>NullEffect</code>.
+ *
+ * @param ctx The effect context
+ * @param name The effect name
+ */
+ public NullEffect(EffectContext ctx, String name) {
+ super(ctx, NullEffect.class.getName());
+ init(VERTEX_SHADER, FRAGMENT_SHADER);
+ }
+
+}
diff --git a/src/org/cyanogenmod/wallpapers/photophase/effects/PhotoPhaseEffectFactory.java b/src/org/cyanogenmod/wallpapers/photophase/effects/PhotoPhaseEffectFactory.java
index 8755acf..450bb47 100644
--- a/src/org/cyanogenmod/wallpapers/photophase/effects/PhotoPhaseEffectFactory.java
+++ b/src/org/cyanogenmod/wallpapers/photophase/effects/PhotoPhaseEffectFactory.java
@@ -73,6 +73,15 @@ public class PhotoPhaseEffectFactory {
public static final String EFFECT_MIRROR = "org.cyanogenmod.wallpapers.photophase.effects.MirrorEffect";
/**
+ * <p>Doesn't apply any effect.</p>
+ * <p>Available parameters:</p>
+ * <table>
+ * <tr><td>Parameter name</td><td>Meaning</td><td>Valid values</td></tr>
+ * </table>
+ */
+ public static final String EFFECT_NULL = "org.cyanogenmod.wallpapers.photophase.effects.NullEffect";
+
+ /**
* <p>Applies an outline effect to the image.</p>
* <p>Available parameters:</p>
* <table>