1/*
2 * Copyright (C) 2013 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.support.v8.renderscript;
18
19import android.util.Log;
20
21class ScriptIntrinsicColorMatrixThunker extends ScriptIntrinsicColorMatrix {
22    android.renderscript.ScriptIntrinsicColorMatrix mN;
23
24    android.renderscript.ScriptIntrinsicColorMatrix getNObj() {
25        return mN;
26    }
27
28    private ScriptIntrinsicColorMatrixThunker(int id, RenderScript rs) {
29        super(id, rs);
30    }
31
32    public static ScriptIntrinsicColorMatrixThunker create(RenderScript rs, Element e) {
33        RenderScriptThunker rst = (RenderScriptThunker) rs;
34        ElementThunker et = (ElementThunker)e;
35
36        ScriptIntrinsicColorMatrixThunker cm =  new ScriptIntrinsicColorMatrixThunker(0, rs);
37        cm.mN = android.renderscript.ScriptIntrinsicColorMatrix.create(rst.mN, et.getNObj());
38        return cm;
39
40    }
41
42    public void setColorMatrix(Matrix4f m) {
43        mN.setColorMatrix(new android.renderscript.Matrix4f(m.getArray()));
44    }
45
46    public void setColorMatrix(Matrix3f m) {
47        mN.setColorMatrix(new android.renderscript.Matrix3f(m.getArray()));
48    }
49
50    public void setGreyscale() {
51        mN.setGreyscale();
52    }
53
54    public void setYUVtoRGB() {
55        mN.setYUVtoRGB();
56    }
57
58    public void setRGBtoYUV() {
59        mN.setRGBtoYUV();
60    }
61
62
63    public void forEach(Allocation ain, Allocation aout) {
64        AllocationThunker aint = (AllocationThunker)ain;
65        AllocationThunker aoutt = (AllocationThunker)aout;
66        mN.forEach(aint.getNObj(), aoutt.getNObj());
67    }
68
69    public Script.KernelID getKernelID() {
70        Script.KernelID k = createKernelID(0, 3, null, null);
71        k.mN = mN.getKernelID();
72        return k;
73    }
74
75}
76
77