1/*
2 * Copyright (C) 2007 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
19public class PathDashPathEffect extends PathEffect {
20
21    public enum Style {
22        TRANSLATE(0),   //!< translate the shape to each position
23        ROTATE(1),      //!< rotate the shape about its center
24        MORPH(2);       //!< transform each point, and turn lines into curves
25
26        Style(int value) {
27            native_style = value;
28        }
29        int native_style;
30    }
31
32    /**
33     * Dash the drawn path by stamping it with the specified shape. This only
34     * applies to drawings when the paint's style is STROKE or STROKE_AND_FILL.
35     * If the paint's style is FILL, then this effect is ignored. The paint's
36     * strokeWidth does not affect the results.
37     * @param shape The path to stamp along
38     * @param advance spacing between each stamp of shape
39     * @param phase amount to offset before the first shape is stamped
40     * @param style how to transform the shape at each position as it is stamped
41     */
42    public PathDashPathEffect(Path shape, float advance, float phase,
43                              Style style) {
44        native_instance = nativeCreate(shape.ni(), advance, phase,
45                                       style.native_style);
46    }
47
48    private static native int nativeCreate(int native_path, float advance,
49                                           float phase, int native_style);
50}
51
52