| 1 | /* | 
|---|
| 2 | * Copyright 2006 The Android Open Source Project | 
|---|
| 3 | * | 
|---|
| 4 | * Use of this source code is governed by a BSD-style license that can be | 
|---|
| 5 | * found in the LICENSE file. | 
|---|
| 6 | */ | 
|---|
| 7 |  | 
|---|
| 8 | #ifndef SkDashPathEffect_DEFINED | 
|---|
| 9 | #define SkDashPathEffect_DEFINED | 
|---|
| 10 |  | 
|---|
| 11 | #include "include/core/SkPathEffect.h" | 
|---|
| 12 |  | 
|---|
| 13 | class SK_API SkDashPathEffect { | 
|---|
| 14 | public: | 
|---|
| 15 | /** intervals: array containing an even number of entries (>=2), with | 
|---|
| 16 | the even indices specifying the length of "on" intervals, and the odd | 
|---|
| 17 | indices specifying the length of "off" intervals. This array will be | 
|---|
| 18 | copied in Make, and can be disposed of freely after. | 
|---|
| 19 | count: number of elements in the intervals array | 
|---|
| 20 | phase: offset into the intervals array (mod the sum of all of the | 
|---|
| 21 | intervals). | 
|---|
| 22 |  | 
|---|
| 23 | For example: if intervals[] = {10, 20}, count = 2, and phase = 25, | 
|---|
| 24 | this will set up a dashed path like so: | 
|---|
| 25 | 5 pixels off | 
|---|
| 26 | 10 pixels on | 
|---|
| 27 | 20 pixels off | 
|---|
| 28 | 10 pixels on | 
|---|
| 29 | 20 pixels off | 
|---|
| 30 | ... | 
|---|
| 31 | A phase of -5, 25, 55, 85, etc. would all result in the same path, | 
|---|
| 32 | because the sum of all the intervals is 30. | 
|---|
| 33 |  | 
|---|
| 34 | Note: only affects stroked paths. | 
|---|
| 35 | */ | 
|---|
| 36 | static sk_sp<SkPathEffect> Make(const SkScalar intervals[], int count, SkScalar phase); | 
|---|
| 37 | }; | 
|---|
| 38 |  | 
|---|
| 39 | #endif | 
|---|
| 40 |  | 
|---|