1 /*
2  * Copyright (C) 2006 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 
17 package android.graphics;
18 
19 import android.compat.annotation.UnsupportedAppUsage;
20 
21 /**
22  * @hide
23  */
24 public class TableMaskFilter extends MaskFilter {
25 
TableMaskFilter(byte[] table)26     public TableMaskFilter(byte[] table) {
27         if (table.length < 256) {
28             throw new RuntimeException("table.length must be >= 256");
29         }
30         native_instance = nativeNewTable(table);
31     }
32 
TableMaskFilter(long ni)33     private TableMaskFilter(long ni) {
34         native_instance = ni;
35     }
36 
37     @UnsupportedAppUsage
CreateClipTable(int min, int max)38     public static TableMaskFilter CreateClipTable(int min, int max) {
39         return new TableMaskFilter(nativeNewClip(min, max));
40     }
41 
CreateGammaTable(float gamma)42     public static TableMaskFilter CreateGammaTable(float gamma) {
43         return new TableMaskFilter(nativeNewGamma(gamma));
44     }
45 
nativeNewTable(byte[] table)46     private static native long nativeNewTable(byte[] table);
nativeNewClip(int min, int max)47     private static native long nativeNewClip(int min, int max);
nativeNewGamma(float gamma)48     private static native long nativeNewGamma(float gamma);
49 }
50