blob: 56c54266d5c1f03d2bafc175838f4a7eec1336a0 [file] [log] [blame]
Jason Sams3a5b8012012-09-08 22:16:14 -07001/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.renderscript;
18
19import android.content.Context;
20import android.content.res.Resources;
21import android.util.Log;
22
23/**
24 * @hide
25 **/
26public class ScriptIntrinsicBlur extends ScriptIntrinsic {
27 private float[] mValues = new float[9];
28 private Allocation mInput;
29
30 ScriptIntrinsicBlur(int id, RenderScript rs) {
31 super(id, rs);
32 }
33
34 /**
35 * Supported elements types are float, float4, uchar, uchar4
36 *
37 *
38 * @param rs
39 * @param e
40 *
41 * @return ScriptIntrinsicConvolve3x3
42 */
43 public static ScriptIntrinsicBlur create(RenderScript rs, Element e) {
44 int id = rs.nScriptIntrinsicCreate(5, e.getID(rs));
45 return new ScriptIntrinsicBlur(id, rs);
46
47 }
48
49 public void setInput(Allocation ain) {
50 mInput = ain;
51 bindAllocation(ain, 1);
52 }
53
54 public void setRadius(float v) {
55 if (v < 0 || v > 25) {
56 throw new RSIllegalArgumentException("Radius out of range (0-25).");
57 }
58 setVar(0, v);
59 }
60
61 public void forEach(Allocation aout) {
62 forEach(0, null, aout, null);
63 }
64
65}
66