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