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