summaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2014-11-11 10:44:49 +0100
committerMichael Bestas <mikeioannina@gmail.com>2015-10-25 11:55:22 +0200
commit09618116991575a0bd725dcaa3434c72d1bf8060 (patch)
treecac4d3e0eaaa714d173c75f04d686deb12fd2152 /res
parentfe0bf1fbbba83e8906c3062184fe4d1dd04eac8e (diff)
downloadandroid_packages_wallpapers_PhaseBeam-09618116991575a0bd725dcaa3434c72d1bf8060.tar.gz
android_packages_wallpapers_PhaseBeam-09618116991575a0bd725dcaa3434c72d1bf8060.tar.bz2
android_packages_wallpapers_PhaseBeam-09618116991575a0bd725dcaa3434c72d1bf8060.zip
Bring over PhaseBeam recoloring from cm-11.0 branch.
Change-Id: Idea935647ce4aa4c1e60657c071b6bd921712bce
Diffstat (limited to 'res')
-rw-r--r--res/drawable-nodpi/beam_grey.pngbin0 -> 2059 bytes
-rw-r--r--res/drawable-nodpi/dot_grey.pngbin0 -> 1359 bytes
-rw-r--r--res/layout/selector.xml82
-rw-r--r--res/raw/bg_fs.glsl27
-rw-r--r--res/raw/bg_vs.glsl6
-rw-r--r--res/raw/dot_fs.glsl30
-rw-r--r--res/raw/dot_vs.glsl4
-rw-r--r--res/values/cm_strings.xml22
-rw-r--r--res/values/config.xml28
-rw-r--r--res/values/styles.xml28
-rw-r--r--res/xml/wallpaper.xml1
11 files changed, 219 insertions, 9 deletions
diff --git a/res/drawable-nodpi/beam_grey.png b/res/drawable-nodpi/beam_grey.png
new file mode 100644
index 0000000..0d3a3b7
--- /dev/null
+++ b/res/drawable-nodpi/beam_grey.png
Binary files differ
diff --git a/res/drawable-nodpi/dot_grey.png b/res/drawable-nodpi/dot_grey.png
new file mode 100644
index 0000000..d785ebf
--- /dev/null
+++ b/res/drawable-nodpi/dot_grey.png
Binary files differ
diff --git a/res/layout/selector.xml b/res/layout/selector.xml
new file mode 100644
index 0000000..32cd68b
--- /dev/null
+++ b/res/layout/selector.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/backgroundview"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginStart="15dip"
+ android:layout_marginEnd="15dip"
+ android:layout_marginBottom="20dip" >
+
+ <CheckBox
+ android:id="@+id/recolor"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_above="@+id/hue_text"
+ android:layout_marginBottom="10dip"
+ android:text="@string/enable_recoloring" />
+
+ <TextView
+ android:id="@+id/hue_text"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_above="@+id/hue"
+ android:layout_marginBottom="5dip"
+ android:text="@string/color_label" />
+
+ <SeekBar
+ android:id="@+id/hue"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_above="@+id/saturation_text"
+ android:layout_marginStart="5dip"
+ android:layout_marginBottom="10dip"
+ android:max="1000" />
+
+ <TextView
+ android:id="@+id/saturation_text"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_above="@+id/saturation"
+ android:layout_marginBottom="5dip"
+ android:text="@string/saturation_label" />
+
+ <SeekBar
+ android:id="@+id/saturation"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_above="@+id/brightness_text"
+ android:layout_marginStart="5dip"
+ android:max="1000" />
+
+ <TextView
+ android:id="@+id/brightness_text"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_above="@+id/brightness"
+ android:layout_marginBottom="5dip"
+ android:text="@string/brightness_label" />
+
+ <SeekBar
+ android:id="@+id/brightness"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="5dip"
+ android:layout_alignParentBottom="true"
+ android:max="1000" />
+
+</RelativeLayout>
diff --git a/res/raw/bg_fs.glsl b/res/raw/bg_fs.glsl
index d20885d..e063f86 100644
--- a/res/raw/bg_fs.glsl
+++ b/res/raw/bg_fs.glsl
@@ -1,5 +1,28 @@
varying lowp vec4 color;
+varying vec3 adjust;
+
+// inspired by http://www.chilliant.com/rgb2hsv.html
+vec3 hsl2rgb(vec3 hsl)
+{
+ // each line has the form abs(6 * hue - K1) * K2 + C
+ const vec3 K1 = vec3(0.5, 1.0 / 3.0, 2.0 / 3.0);
+ const vec3 K2 = vec3(1.0, -1.0, -1.0);
+ const vec3 C = vec3(-1.0, 2.0, 2.0);
+
+ vec3 rgb = clamp(abs(6.0 * (hsl.xxx - K1.xyz)) * K2 + C, 0.0, 1.0);
+ float chroma = (1.0 - abs(2.0 * hsl.z - 1.0)) * hsl.y;
+ return (rgb - 0.5) * chroma + hsl.z;
+}
void main() {
- gl_FragColor = color;
-} \ No newline at end of file
+ vec3 rgb = color.rgb;
+
+ if (adjust.x >= 0.0) {
+ // rgb is already greyscale in that case, so r = g = b
+ vec3 hsl = adjust * vec3(1.0, 1.0, rgb.r);
+ rgb = hsl2rgb(hsl);
+ }
+
+ // output pixel color
+ gl_FragColor = vec4(rgb, color.a);
+}
diff --git a/res/raw/bg_vs.glsl b/res/raw/bg_vs.glsl
index 8eb23b3..eeb912b 100644
--- a/res/raw/bg_vs.glsl
+++ b/res/raw/bg_vs.glsl
@@ -1,6 +1,8 @@
varying lowp vec4 color;
+varying vec3 adjust;
void main() {
- color = ATTRIB_color;
+ adjust = ATTRIB_adjust;
+ color = ATTRIB_realColor;
gl_Position = vec4(ATTRIB_position.x + ATTRIB_offsetX/3.5, ATTRIB_position.y, 0.0, 1.0);
-} \ No newline at end of file
+}
diff --git a/res/raw/dot_fs.glsl b/res/raw/dot_fs.glsl
index 3ef90ed..78e7ed3 100644
--- a/res/raw/dot_fs.glsl
+++ b/res/raw/dot_fs.glsl
@@ -1,6 +1,28 @@
varying float pointSize;
+varying vec3 adjust;
-void main() {
- gl_FragColor = texture2D(UNI_Tex0, gl_PointCoord);
- gl_FragColor.a = pointSize;
-} \ No newline at end of file
+// inspired by http://www.chilliant.com/rgb2hsv.html
+vec3 hsl2rgb(vec3 hsl)
+{
+ // each line has the form abs(6 * hue - K1) * K2 + C
+ const vec3 K1 = vec3(0.5, 1.0 / 3.0, 2.0 / 3.0);
+ const vec3 K2 = vec3(1.0, -1.0, -1.0);
+ const vec3 C = vec3(-1.0, 2.0, 2.0);
+
+ vec3 rgb = clamp(abs(6.0 * (hsl.xxx - K1.xyz)) * K2 + C, 0.0, 1.0);
+ float chroma = (1.0 - abs(2.0 * hsl.z - 1.0)) * hsl.y;
+ return (rgb - 0.5) * chroma + hsl.z;
+}
+
+void main() {
+ vec3 rgb = texture2D(UNI_Tex0, gl_PointCoord).rgb;
+
+ if (adjust.x >= 0.0) {
+ // rgb is already greyscale in that case, so r = g = b
+ vec3 hsl = adjust * vec3(1.0, 1.0, rgb.r);
+ rgb = hsl2rgb(hsl);
+ }
+
+ // output pixel color
+ gl_FragColor = vec4(rgb, pointSize);
+}
diff --git a/res/raw/dot_vs.glsl b/res/raw/dot_vs.glsl
index 9cf3c74..8c7fdd1 100644
--- a/res/raw/dot_vs.glsl
+++ b/res/raw/dot_vs.glsl
@@ -1,4 +1,5 @@
varying float pointSize;
+varying vec3 adjust;
void main() {
vec4 objPos = vec4(ATTRIB_position, 1.0);
@@ -6,6 +7,7 @@ void main() {
pointSize = 0.5-tmpPointSize/1000.0;
objPos.z = 0.0;
objPos.x = objPos.x - ATTRIB_offsetX * tmpPointSize/100.0;
+ adjust = ATTRIB_adjust;
gl_Position = objPos;
gl_PointSize = tmpPointSize*UNI_scaleSize;
-} \ No newline at end of file
+}
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
new file mode 100644
index 0000000..5d62eee
--- /dev/null
+++ b/res/values/cm_strings.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2013-2014 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.
+-->
+<resources>
+ <string name="enable_recoloring">Adjust beam colors</string>
+ <string name="color_label">Color</string>
+ <string name="saturation_label">Saturation</string>
+ <string name="brightness_label">Brightness</string>
+</resources>
diff --git a/res/values/config.xml b/res/values/config.xml
new file mode 100644
index 0000000..3e7ae7e
--- /dev/null
+++ b/res/values/config.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- Whether recoloring is enabled by default -->
+ <bool name="recolor_enabled">false</bool>
+ <!-- Default values for the color controls -->
+ <item name="hue" format="float" type="string">0.0</item>
+ <item name="saturation" format="float" type="string">1.0</item>
+ <item name="brightness" format="float" type="string">1.0</item>
+ <!-- Whether horizontal scrolling is enabled -->
+ <bool name="scrolling_enabled">true</bool>
+
+</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
new file mode 100644
index 0000000..81e2db6
--- /dev/null
+++ b/res/values/styles.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+* Copyright (C) 2008 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.
+*/
+-->
+
+<resources>
+ <style name="Transparent">
+ <item name="android:windowBackground">@android:color/transparent</item>
+ <item name="android:windowActionBar">false</item>
+ <item name="android:windowNoTitle">true</item>
+ <item name="android:windowContentOverlay">@null</item>
+ <item name="android:windowAnimationStyle">@android:style/Animation.Translucent</item>
+ </style>
+</resources>
diff --git a/res/xml/wallpaper.xml b/res/xml/wallpaper.xml
index 572063d..17cddeb 100644
--- a/res/xml/wallpaper.xml
+++ b/res/xml/wallpaper.xml
@@ -18,5 +18,6 @@
-->
<wallpaper xmlns:android="http://schemas.android.com/apk/res/android"
+ android:settingsActivity="com.android.phasebeam.PhaseBeamSelector"
android:author="@string/wallpaper_author"
android:thumbnail="@drawable/wallpaper_thumb" />