00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef Sk1DPathEffect_DEFINED
00018 #define Sk1DPathEffect_DEFINED
00019
00020 #include "SkPathEffect.h"
00021 #include "SkPath.h"
00022
00023 class SkPathMeasure;
00024
00025
00026 class Sk1DPathEffect : public SkPathEffect {
00027 public:
00028
00029 virtual bool filterPath(SkPath* dst, const SkPath& src, SkScalar* width);
00030
00031 protected:
00035 virtual SkScalar begin(SkScalar contourLength) = 0;
00041 virtual SkScalar next(SkPath* dst, SkScalar distance, SkPathMeasure&) = 0;
00042
00043 private:
00044 typedef SkPathEffect INHERITED;
00045 };
00046
00047 class SkPath1DPathEffect : public Sk1DPathEffect {
00048 public:
00049 enum Style {
00050 kTranslate_Style,
00051 kRotate_Style,
00052 kMorph_Style,
00053
00054 kStyleCount
00055 };
00056
00064 SkPath1DPathEffect(const SkPath& path, SkScalar advance, SkScalar phase, Style);
00065
00066
00067 virtual bool filterPath(SkPath* dst, const SkPath& src, SkScalar* width);
00068
00069 protected:
00070 SkPath1DPathEffect(SkFlattenableReadBuffer& buffer);
00071
00072
00073 virtual SkScalar begin(SkScalar contourLength);
00074 virtual SkScalar next(SkPath* dst, SkScalar distance, SkPathMeasure&);
00075
00076 virtual void flatten(SkFlattenableWriteBuffer& );
00077 virtual Factory getFactory() { return CreateProc; }
00078
00079 private:
00080 SkPath fPath;
00081 SkScalar fAdvance;
00082 SkScalar fInitialOffset;
00083 Style fStyle;
00084
00085 static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
00086 return SkNEW_ARGS(SkPath1DPathEffect, (buffer));
00087 }
00088
00089 typedef Sk1DPathEffect INHERITED;
00090 };
00091
00092
00093 #endif