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 SkDiscretePathEffect_DEFINED |
| 9 | #define SkDiscretePathEffect_DEFINED |
| 10 | |
| 11 | #include "SkPathEffect.h" |
| 12 | |
| 13 | /** \class SkDiscretePathEffect |
| 14 | |
| 15 | This path effect chops a path into discrete segments, and randomly displaces them. |
| 16 | */ |
tfarina@chromium.org | 6806fe8 | 2012-10-12 14:41:39 +0000 | [diff] [blame] | 17 | class SK_API SkDiscretePathEffect : public SkPathEffect { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 18 | public: |
| 19 | /** Break the path into segments of segLength length, and randomly move the endpoints |
| 20 | away from the original path by a maximum of deviation. |
| 21 | Note: works on filled or framed paths |
| 22 | */ |
| 23 | SkDiscretePathEffect(SkScalar segLength, SkScalar deviation); |
| 24 | |
reed@google.com | 548a1f3 | 2012-12-18 16:12:09 +0000 | [diff] [blame] | 25 | virtual bool filterPath(SkPath* dst, const SkPath& src, |
reed@google.com | 4bbdeac | 2013-01-24 21:03:11 +0000 | [diff] [blame] | 26 | SkStrokeRec*, const SkRect*) const SK_OVERRIDE; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 27 | |
djsollen@google.com | ba28d03 | 2012-03-26 17:57:35 +0000 | [diff] [blame] | 28 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDiscretePathEffect) |
reed@google.com | 6bac947 | 2011-06-21 19:24:00 +0000 | [diff] [blame] | 29 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 30 | protected: |
| 31 | SkDiscretePathEffect(SkFlattenableReadBuffer&); |
djsollen@google.com | 5492424 | 2012-03-29 15:18:04 +0000 | [diff] [blame] | 32 | virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 33 | |
| 34 | private: |
| 35 | SkScalar fSegLength, fPerterb; |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 36 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 37 | typedef SkPathEffect INHERITED; |
| 38 | }; |
| 39 | |
| 40 | #endif |