epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 2 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 3 | * Copyright 2006 The Android Open Source Project |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 4 | * |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 9 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 10 | #ifndef SkDashPathEffect_DEFINED |
| 11 | #define SkDashPathEffect_DEFINED |
| 12 | |
| 13 | #include "SkPathEffect.h" |
| 14 | |
| 15 | /** \class SkDashPathEffect |
| 16 | |
| 17 | SkDashPathEffect is a subclass of SkPathEffect that implements dashing |
| 18 | */ |
ctguil@chromium.org | 7ffb1b2 | 2011-03-15 21:27:08 +0000 | [diff] [blame] | 19 | class SK_API SkDashPathEffect : public SkPathEffect { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 20 | public: |
| 21 | /** The intervals array must contain an even number of entries (>=2), with the even |
| 22 | indices specifying the "on" intervals, and the odd indices specifying the "off" |
| 23 | intervals. phase is an offset into the intervals array (mod the sum of all of the |
| 24 | intervals). |
| 25 | Note: only affects framed paths |
| 26 | */ |
| 27 | SkDashPathEffect(const SkScalar intervals[], int count, SkScalar phase, bool scaleToFit = false); |
| 28 | virtual ~SkDashPathEffect(); |
| 29 | |
| 30 | // overrides for SkPathEffect |
| 31 | // This method is not exported to java. |
| 32 | virtual bool filterPath(SkPath* dst, const SkPath& src, SkScalar* width); |
| 33 | |
| 34 | // overrides for SkFlattenable |
| 35 | // This method is not exported to java. |
| 36 | virtual Factory getFactory(); |
| 37 | // This method is not exported to java. |
| 38 | virtual void flatten(SkFlattenableWriteBuffer&); |
| 39 | |
reed@google.com | 6bac947 | 2011-06-21 19:24:00 +0000 | [diff] [blame] | 40 | static SkFlattenable* CreateProc(SkFlattenableReadBuffer&); |
| 41 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 42 | protected: |
| 43 | SkDashPathEffect(SkFlattenableReadBuffer&); |
| 44 | |
| 45 | private: |
| 46 | SkScalar* fIntervals; |
| 47 | int32_t fCount; |
| 48 | // computed from phase |
| 49 | SkScalar fInitialDashLength; |
| 50 | int32_t fInitialDashIndex; |
| 51 | SkScalar fIntervalLength; |
| 52 | bool fScaleToFit; |
| 53 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 54 | typedef SkPathEffect INHERITED; |
| 55 | }; |
| 56 | |
| 57 | #endif |
| 58 | |