reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 1 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 2 | * Copyright 2006 The Android Open Source Project |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 3 | * |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #ifndef SkDashPathEffect_DEFINED |
| 9 | #define SkDashPathEffect_DEFINED |
| 10 | |
| 11 | #include "SkPathEffect.h" |
| 12 | |
Mike Reed | 76f7062 | 2017-05-23 23:00:14 -0400 | [diff] [blame] | 13 | class SK_API SkDashPathEffect { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 14 | public: |
epoger@google.com | 20bf4ca | 2012-04-27 13:34:52 +0000 | [diff] [blame] | 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. |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 18 | count: number of elements in the intervals array |
epoger@google.com | 20bf4ca | 2012-04-27 13:34:52 +0000 | [diff] [blame] | 19 | phase: offset into the intervals array (mod the sum of all of the |
| 20 | intervals). |
| 21 | |
| 22 | For example: if intervals[] = {10, 20}, count = 2, and phase = 25, |
| 23 | this will set up a dashed path like so: |
| 24 | 5 pixels off |
| 25 | 10 pixels on |
| 26 | 20 pixels off |
| 27 | 10 pixels on |
| 28 | 20 pixels off |
| 29 | ... |
| 30 | A phase of -5, 25, 55, 85, etc. would all result in the same path, |
| 31 | because the sum of all the intervals is 30. |
| 32 | |
| 33 | Note: only affects stroked paths. |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 34 | */ |
reed | a439334 | 2016-03-18 11:22:57 -0700 | [diff] [blame] | 35 | static sk_sp<SkPathEffect> Make(const SkScalar intervals[], int count, SkScalar phase); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 36 | }; |
| 37 | |
| 38 | #endif |