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