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 public class DashPathEffect extends PathEffect { 20 21 /** 22 * The intervals array must contain an even number of entries (>=2), with 23 * the even indices specifying the "on" intervals, and the odd indices 24 * specifying the "off" intervals. phase is an offset into the intervals 25 * array (mod the sum of all of the intervals). The intervals array 26 * controls the length of the dashes. The paint's strokeWidth controls the 27 * thickness of the dashes. 28 * Note: this patheffect only affects drawing with the paint's style is set 29 * to STROKE or FILL_AND_STROKE. It is ignored if the drawing is done with 30 * style == FILL. 31 * @param intervals array of ON and OFF distances 32 * @param phase offset into the intervals array 33 */ DashPathEffect(float intervals[], float phase)34 public DashPathEffect(float intervals[], float phase) { 35 if (intervals.length < 2) { 36 throw new ArrayIndexOutOfBoundsException(); 37 } 38 native_instance = nativeCreate(intervals, phase); 39 } 40 nativeCreate(float intervals[], float phase)41 private static native long nativeCreate(float intervals[], float phase); 42 } 43 44