Trevor Johns | 89d2da0 | 2015-08-13 18:28:15 -0700 | [diff] [blame] | 1 | |
Trevor Johns | e904b62 | 2014-08-27 18:30:35 -0700 | [diff] [blame] | 2 | Android RenderScriptIntrinsic Sample |
Trevor Johns | 89d2da0 | 2015-08-13 18:28:15 -0700 | [diff] [blame] | 3 | =================================== |
Trevor Johns | e904b62 | 2014-08-27 18:30:35 -0700 | [diff] [blame] | 4 | |
| 5 | RenderScriptIntrinsic sample that demonstrates how to use RenderScript intrinsics. |
| 6 | Creates several RenderScript intrinsics and shows a filtering result with various parameters. |
| 7 | Also shows how to extends RedioButton with StateListDrawable. |
| 8 | |
Trevor Johns | 89d2da0 | 2015-08-13 18:28:15 -0700 | [diff] [blame] | 9 | Introduction |
| 10 | ------------ |
| 11 | |
Yuichi Araki | 39b0129 | 2016-07-08 13:54:27 +0900 | [diff] [blame] | 12 | [RenderScript][1] is a framework for running computationally intensive tasks at high performance on |
| 13 | Android. RenderScript is primarily oriented for use with data-parallel computation, although serial |
| 14 | computationally intensive workloads can benefit as well. |
Trevor Johns | 89d2da0 | 2015-08-13 18:28:15 -0700 | [diff] [blame] | 15 | |
| 16 | RenderScript **intrinsics** are built-in functions that perform well-defined operations often seen |
| 17 | in image processing. Intrinsics provide extremely high-performance implementations of standard |
| 18 | functions with a minimal amount of code. |
| 19 | |
| 20 | This sample shows how to access and use the blur, convolve, and matrix intrinsics: |
| 21 | |
| 22 | ```java |
| 23 | mScriptBlur = ScriptIntrinsicBlur.create(mRS, Element.U8_4(mRS)); |
| 24 | mScriptConvolve = ScriptIntrinsicConvolve5x5.create(mRS, |
| 25 | Element.U8_4(mRS)); |
| 26 | mScriptMatrix = ScriptIntrinsicColorMatrix.create(mRS, |
| 27 | Element.U8_4(mRS)); |
| 28 | ``` |
| 29 | |
Yuichi Araki | 39b0129 | 2016-07-08 13:54:27 +0900 | [diff] [blame] | 30 | RenderScript intrinsics will usually be the fastest possible way for a developer to perform these |
| 31 | operations. The Android team works closely with our partners to ensure that the intrinsics perform |
| 32 | as fast as possible on their architectures — often far beyond anything that can be achieved in a |
| 33 | general-purpose language. |
Trevor Johns | 89d2da0 | 2015-08-13 18:28:15 -0700 | [diff] [blame] | 34 | |
| 35 | [1]: http://developer.android.com/guide/topics/renderscript/compute.html |
| 36 | |
Trevor Johns | e904b62 | 2014-08-27 18:30:35 -0700 | [diff] [blame] | 37 | Pre-requisites |
| 38 | -------------- |
| 39 | |
Yuichi Araki | 39b0129 | 2016-07-08 13:54:27 +0900 | [diff] [blame] | 40 | - Android SDK 24 |
Trevor Johns | 0d2f2c6 | 2016-09-28 22:15:23 -0700 | [diff] [blame] | 41 | - Android Build Tools v24.0.2 |
Trevor Johns | e904b62 | 2014-08-27 18:30:35 -0700 | [diff] [blame] | 42 | - Android Support Repository |
| 43 | |
Trevor Johns | 89d2da0 | 2015-08-13 18:28:15 -0700 | [diff] [blame] | 44 | Screenshots |
| 45 | ------------- |
| 46 | |
| 47 | <img src="screenshots/main.png" height="400" alt="Screenshot"/> |
| 48 | |
Trevor Johns | e904b62 | 2014-08-27 18:30:35 -0700 | [diff] [blame] | 49 | Getting Started |
| 50 | --------------- |
| 51 | |
| 52 | This sample uses the Gradle build system. To build this project, use the |
| 53 | "gradlew build" command or use "Import Project" in Android Studio. |
| 54 | |
| 55 | Support |
| 56 | ------- |
| 57 | |
| 58 | - Google+ Community: https://plus.google.com/communities/105153134372062985968 |
| 59 | - Stack Overflow: http://stackoverflow.com/questions/tagged/android |
| 60 | |
| 61 | If you've found an error in this sample, please file an issue: |
| 62 | https://github.com/googlesamples/android-RenderScriptIntrinsic |
| 63 | |
| 64 | Patches are encouraged, and may be submitted by forking this project and |
| 65 | submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details. |
| 66 | |
| 67 | License |
| 68 | ------- |
| 69 | |
Yuichi Araki | 39b0129 | 2016-07-08 13:54:27 +0900 | [diff] [blame] | 70 | Copyright 2016 The Android Open Source Project, Inc. |
Trevor Johns | e904b62 | 2014-08-27 18:30:35 -0700 | [diff] [blame] | 71 | |
| 72 | Licensed to the Apache Software Foundation (ASF) under one or more contributor |
| 73 | license agreements. See the NOTICE file distributed with this work for |
| 74 | additional information regarding copyright ownership. The ASF licenses this |
| 75 | file to you under the Apache License, Version 2.0 (the "License"); you may not |
| 76 | use this file except in compliance with the License. You may obtain a copy of |
| 77 | the License at |
| 78 | |
Trevor Johns | 89d2da0 | 2015-08-13 18:28:15 -0700 | [diff] [blame] | 79 | http://www.apache.org/licenses/LICENSE-2.0 |
Trevor Johns | e904b62 | 2014-08-27 18:30:35 -0700 | [diff] [blame] | 80 | |
| 81 | Unless required by applicable law or agreed to in writing, software |
| 82 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 83 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 84 | License for the specific language governing permissions and limitations under |
| 85 | the License. |