blob: 22b5dd360bbca90a944fd243a32ee4e2bb3af8bc [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
reed@android.com8a1c16f2008-12-17 15:59:43 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * Copyright 2006 The Android Open Source Project
reed@android.com8a1c16f2008-12-17 15:59:43 +00004 *
epoger@google.comec3ed6a2011-07-28 14:26:00 +00005 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
reed@android.com8a1c16f2008-12-17 15:59:43 +00007 */
8
epoger@google.comec3ed6a2011-07-28 14:26:00 +00009
reed@android.com8a1c16f2008-12-17 15:59:43 +000010#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.
17class Sk2DPathEffect : public SkPathEffect {
18public:
19 Sk2DPathEffect(const SkMatrix& mat);
20
21 // overrides
22 // This method is not exported to java.
mike@reedtribe.org6b919c32011-04-20 11:17:30 +000023 virtual bool filterPath(SkPath* dst, const SkPath& src, SkScalar* width);
reed@android.com8a1c16f2008-12-17 15:59:43 +000024
25 // overrides from SkFlattenable
26 // This method is not exported to java.
mike@reedtribe.org6b919c32011-04-20 11:17:30 +000027 virtual void flatten(SkFlattenableWriteBuffer&);
reed@android.com8a1c16f2008-12-17 15:59:43 +000028
29 // This method is not exported to java.
mike@reedtribe.org6b919c32011-04-20 11:17:30 +000030 virtual Factory getFactory();
reed@android.com8a1c16f2008-12-17 15:59:43 +000031
reed@google.come28b9172011-08-09 18:14:31 +000032 static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
33
reed@android.com8a1c16f2008-12-17 15:59:43 +000034protected:
35 /** New virtual, to be overridden by subclasses.
36 This is called once from filterPath, and provides the
37 uv parameter bounds for the path. Subsequent calls to
38 next() will receive u and v values within these bounds,
39 and then a call to end() will signal the end of processing.
40 */
41 virtual void begin(const SkIRect& uvBounds, SkPath* dst);
42 virtual void next(const SkPoint& loc, int u, int v, SkPath* dst);
43 virtual void end(SkPath* dst);
44
45 /** Low-level virtual called per span of locations in the u-direction.
46 The default implementation calls next() repeatedly with each
47 location.
48 */
49 virtual void nextSpan(int u, int v, int ucount, SkPath* dst);
50
51 const SkMatrix& getMatrix() const { return fMatrix; }
52
53 // protected so that subclasses can call this during unflattening
54 Sk2DPathEffect(SkFlattenableReadBuffer&);
55
56private:
57 SkMatrix fMatrix, fInverse;
58 // illegal
59 Sk2DPathEffect(const Sk2DPathEffect&);
60 Sk2DPathEffect& operator=(const Sk2DPathEffect&);
61
reed@android.com8a1c16f2008-12-17 15:59:43 +000062 friend class Sk2DPathEffectBlitter;
63 typedef SkPathEffect INHERITED;
64};
65
66#endif