summaryrefslogtreecommitdiffstats
path: root/samples/browseable/BasicRenderScript/src
diff options
context:
space:
mode:
authorAlexander Lucas <alexlucas@google.com>2014-04-10 15:44:01 -0700
committerAlexander Lucas <alexlucas@google.com>2014-04-10 15:44:01 -0700
commitfb5e574e7953a646b95652632d0c4c87a47f4d5e (patch)
treed5088f81657abddfb38826713c0e6dfbc8d1fc61 /samples/browseable/BasicRenderScript/src
parentf03f35fe248d4cf9ead29251d793f65f9f9f4c55 (diff)
downloadandroid_development-fb5e574e7953a646b95652632d0c4c87a47f4d5e.tar.gz
android_development-fb5e574e7953a646b95652632d0c4c87a47f4d5e.tar.bz2
android_development-fb5e574e7953a646b95652632d0c4c87a47f4d5e.zip
Updated browseable samples for april push
Change-Id: Idd8cc6b7c43ab93f05f0a5d69d5379631721d185
Diffstat (limited to 'samples/browseable/BasicRenderScript/src')
-rw-r--r--samples/browseable/BasicRenderScript/src/rs/saturation.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/samples/browseable/BasicRenderScript/src/rs/saturation.rs b/samples/browseable/BasicRenderScript/src/rs/saturation.rs
new file mode 100644
index 000000000..cf043d141
--- /dev/null
+++ b/samples/browseable/BasicRenderScript/src/rs/saturation.rs
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(com.example.android.basicrenderscript)
+#pragma rs_fp_relaxed
+
+const static float3 gMonoMult = {0.299f, 0.587f, 0.114f};
+
+float saturationValue = 0.f;
+
+/*
+RenderScript kernel that performs saturation manipulation.
+*/
+uchar4 __attribute__((kernel)) saturation(uchar4 in)
+{
+ float4 f4 = rsUnpackColor8888(in);
+ float3 result = dot(f4.rgb, gMonoMult);
+ result = mix( result, f4.rgb, saturationValue );
+
+ return rsPackColorTo8888(result);
+}
+