blob: 225cb5672fb46a8076192c4760de784b108d1811 [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
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
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
30RenderScript intrinsics will usually be the fastest possible way for a developer to perform these operations. The
31Android team works closely with our partners to ensure that the intrinsics perform as fast as possible on their
32architectures often far beyond anything that can be achieved in a general-purpose language.
33
34[1]: http://developer.android.com/guide/topics/renderscript/compute.html
35
Trevor Johnse904b622014-08-27 18:30:35 -070036Pre-requisites
37--------------
38
Trevor Johnsfc1c2ea2016-08-11 15:43:37 -070039- Android SDK 24
Trevor Johns0d2f2c62016-09-28 22:15:23 -070040- Android Build Tools v24.0.2
Trevor Johnse904b622014-08-27 18:30:35 -070041- Android Support Repository
42
Trevor Johns89d2da02015-08-13 18:28:15 -070043Screenshots
44-------------
45
46<img src="screenshots/main.png" height="400" alt="Screenshot"/>
47
Trevor Johnse904b622014-08-27 18:30:35 -070048Getting Started
49---------------
50
51This sample uses the Gradle build system. To build this project, use the
52"gradlew build" command or use "Import Project" in Android Studio.
53
54Support
55-------
56
57- Google+ Community: https://plus.google.com/communities/105153134372062985968
58- Stack Overflow: http://stackoverflow.com/questions/tagged/android
59
60If you've found an error in this sample, please file an issue:
61https://github.com/googlesamples/android-RenderScriptIntrinsic
62
63Patches are encouraged, and may be submitted by forking this project and
64submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details.
65
66License
67-------
68
Trevor Johnsfc1c2ea2016-08-11 15:43:37 -070069Copyright 2016 The Android Open Source Project, Inc.
Trevor Johnse904b622014-08-27 18:30:35 -070070
71Licensed to the Apache Software Foundation (ASF) under one or more contributor
72license agreements. See the NOTICE file distributed with this work for
73additional information regarding copyright ownership. The ASF licenses this
74file to you under the Apache License, Version 2.0 (the "License"); you may not
75use this file except in compliance with the License. You may obtain a copy of
76the License at
77
Trevor Johns89d2da02015-08-13 18:28:15 -070078http://www.apache.org/licenses/LICENSE-2.0
Trevor Johnse904b622014-08-27 18:30:35 -070079
80Unless required by applicable law or agreed to in writing, software
81distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
82WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
83License for the specific language governing permissions and limitations under
84the License.