| 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 Sk2DPathEffect_DEFINED |
| 11 | #define Sk2DPathEffect_DEFINED |
| 12 | |
| 13 | #include "SkPathEffect.h" |
| 14 | #include "SkMatrix.h" |
| 15 | |
| 16 | // This class is not exported to java. |
| 17 | class Sk2DPathEffect : public SkPathEffect { |
| 18 | public: |
| 19 | Sk2DPathEffect(const SkMatrix& mat); |
| 20 | |
| 21 | // overrides |
| 22 | // This method is not exported to java. |
| mike@reedtribe.org | 6b919c3 | 2011-04-20 11:17:30 +0000 | [diff] [blame] | 23 | virtual bool filterPath(SkPath* dst, const SkPath& src, SkScalar* width); |
| reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 24 | |
| 25 | // overrides from SkFlattenable |
| 26 | // This method is not exported to java. |
| mike@reedtribe.org | 6b919c3 | 2011-04-20 11:17:30 +0000 | [diff] [blame] | 27 | virtual void flatten(SkFlattenableWriteBuffer&); |
| reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 28 | |
| 29 | // This method is not exported to java. |
| mike@reedtribe.org | 6b919c3 | 2011-04-20 11:17:30 +0000 | [diff] [blame] | 30 | virtual Factory getFactory(); |
| reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 31 | |
| 32 | protected: |
| 33 | /** New virtual, to be overridden by subclasses. |
| 34 | This is called once from filterPath, and provides the |
| 35 | uv parameter bounds for the path. Subsequent calls to |
| 36 | next() will receive u and v values within these bounds, |
| 37 | and then a call to end() will signal the end of processing. |
| 38 | */ |
| 39 | virtual void begin(const SkIRect& uvBounds, SkPath* dst); |
| 40 | virtual void next(const SkPoint& loc, int u, int v, SkPath* dst); |
| 41 | virtual void end(SkPath* dst); |
| 42 | |
| 43 | /** Low-level virtual called per span of locations in the u-direction. |
| 44 | The default implementation calls next() repeatedly with each |
| 45 | location. |
| 46 | */ |
| 47 | virtual void nextSpan(int u, int v, int ucount, SkPath* dst); |
| 48 | |
| 49 | const SkMatrix& getMatrix() const { return fMatrix; } |
| 50 | |
| 51 | // protected so that subclasses can call this during unflattening |
| 52 | Sk2DPathEffect(SkFlattenableReadBuffer&); |
| 53 | |
| 54 | private: |
| 55 | SkMatrix fMatrix, fInverse; |
| 56 | // illegal |
| 57 | Sk2DPathEffect(const Sk2DPathEffect&); |
| 58 | Sk2DPathEffect& operator=(const Sk2DPathEffect&); |
| 59 | |
| 60 | static SkFlattenable* CreateProc(SkFlattenableReadBuffer&); |
| 61 | |
| 62 | friend class Sk2DPathEffectBlitter; |
| 63 | typedef SkPathEffect INHERITED; |
| 64 | }; |
| 65 | |
| 66 | #endif |