1 2Android BasicRenderScript Sample 3=================================== 4 5This sample demonstrates using RenderScript to perform basic image manipulation. Specifically, it allows users 6to dynamically adjust the saturation for an image using a slider. A custom RenderScript kernel performs the saturation 7adjustment, running the computation on the device\'s GPU or other compute hardware as deemed appropriate by the system. 8 9Introduction 10------------ 11 12[RenderScript][1] is a framework for running computationally intensive tasks at high performance on Android. RenderScript is 13primarily oriented for use with data-parallel computation, although serial computationally intensive workloads can 14benefit as well. 15 16The RenderScript runtime will parallelize work across all processors available on a device, such as multi-core CPUs, 17GPUs, or DSPs, allowing you to focus on expressing algorithms rather than scheduling work or load balancing. 18RenderScript is especially useful for applications performing image processing, computational photography, or computer 19vision. 20 21This sample demonstrates the fundamentals of writing a RenderScript compute kernel, and using it to perform basic image 22manipulation. In this case, each pixel is transformed based on a liner interpolation between its original 23RGB value and it's luminance (black-and-white) value, weighted based on the user's specified saturation target. 24 25[1]: http://developer.android.com/guide/topics/renderscript/compute.html 26[2]: http://developer.android.com/reference/renderscript/rs__cl_8rsh.html#a254612a612ff7539b01a1478e03d8697 27 28Pre-requisites 29-------------- 30 31- Android SDK 27 32- Android Build Tools v27.0.2 33- Android Support Repository 34 35Screenshots 36------------- 37 38<img src="screenshots/main.png" height="400" alt="Screenshot"/> 39 40Getting Started 41--------------- 42 43This sample uses the Gradle build system. To build this project, use the 44"gradlew build" command or use "Import Project" in Android Studio. 45 46Support 47------- 48 49- Google+ Community: https://plus.google.com/communities/105153134372062985968 50- Stack Overflow: http://stackoverflow.com/questions/tagged/android 51 52If you've found an error in this sample, please file an issue: 53https://github.com/googlesamples/android-BasicRenderScript 54 55Patches are encouraged, and may be submitted by forking this project and 56submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details. 57 58License 59------- 60 61Copyright 2017 The Android Open Source Project, Inc. 62 63Licensed to the Apache Software Foundation (ASF) under one or more contributor 64license agreements. See the NOTICE file distributed with this work for 65additional information regarding copyright ownership. The ASF licenses this 66file to you under the Apache License, Version 2.0 (the "License"); you may not 67use this file except in compliance with the License. You may obtain a copy of 68the License at 69 70http://www.apache.org/licenses/LICENSE-2.0 71 72Unless required by applicable law or agreed to in writing, software 73distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 74WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 75License for the specific language governing permissions and limitations under 76the License. 77