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