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
17package 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 */
25public class BlurMaskFilter extends MaskFilter {
26
27    public enum Blur {
28        NORMAL(0),  //!< blur inside and outside of the original border
29        SOLID(1),   //!< include the original mask, blur outside
30        OUTER(2),   //!< just blur outside the original border
31        INNER(3);   //!< just blur inside the original border
32
33        Blur(int value) {
34            native_int = value;
35        }
36        final int native_int;
37    }
38
39    /**
40     * Create a blur maskfilter.
41     *
42     * @param radius The radius to extend the blur from the original mask. Must be > 0.
43     * @param style  The Blur to use
44     * @return       The new blur maskfilter
45     */
46    public BlurMaskFilter(float radius, Blur style) {
47        native_instance = nativeConstructor(radius, style.native_int);
48    }
49
50    private static native int nativeConstructor(float radius, int style);
51}
52