• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  * This takes a mask, and blurs its edge by the specified radius. Whether or
21  * or not to include the original mask, and whether the blur goes outside,
22  * inside, or straddles, the original mask's border, is controlled by the
23  * Blur enum.
24  */
25 @android.ravenwood.annotation.RavenwoodKeepWholeClass
26 public class BlurMaskFilter extends MaskFilter {
27 
28     public enum Blur {
29         /**
30          * Blur inside and outside the original border.
31          */
32         NORMAL(0),
33 
34         /**
35          * Draw solid inside the border, blur outside.
36          */
37         SOLID(1),
38 
39         /**
40          * Draw nothing inside the border, blur outside.
41          */
42         OUTER(2),
43 
44         /**
45          * Blur inside the border, draw nothing outside.
46          */
47         INNER(3);
48 
Blur(int value)49         Blur(int value) {
50             native_int = value;
51         }
52         final int native_int;
53     }
54 
55     /**
56      * Create a blur maskfilter.
57      *
58      * @param radius The radius to extend the blur from the original mask. Must be > 0.
59      * @param style  The Blur to use
60      * @return       The new blur maskfilter
61      */
BlurMaskFilter(float radius, Blur style)62     public BlurMaskFilter(float radius, Blur style) {
63         native_instance = nativeConstructor(radius, style.native_int);
64     }
65 
nativeConstructor(float radius, int style)66     private static native long nativeConstructor(float radius, int style);
67 }
68