blob: 29a6d1b59a4da9c655751e5b3f8a9efee0084433 [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 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.org7ffb1b22011-03-15 21:27:08 +000019class SK_API SkDashPathEffect : public SkPathEffect {
reed@android.com8a1c16f2008-12-17 15:59:43 +000020public:
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.com6bac9472011-06-21 19:24:00 +000040 static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
41
reed@android.com8a1c16f2008-12-17 15:59:43 +000042protected:
43 SkDashPathEffect(SkFlattenableReadBuffer&);
44
45private:
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.com8a1c16f2008-12-17 15:59:43 +000054 typedef SkPathEffect INHERITED;
55};
56
57#endif
58