michael@0: /* michael@0: * Copyright 2006 The Android Open Source Project michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #ifndef SkDiscretePathEffect_DEFINED michael@0: #define SkDiscretePathEffect_DEFINED michael@0: michael@0: #include "SkPathEffect.h" michael@0: michael@0: /** \class SkDiscretePathEffect michael@0: michael@0: This path effect chops a path into discrete segments, and randomly displaces them. michael@0: */ michael@0: class SK_API SkDiscretePathEffect : public SkPathEffect { michael@0: public: michael@0: /** Break the path into segments of segLength length, and randomly move the endpoints michael@0: away from the original path by a maximum of deviation. michael@0: Note: works on filled or framed paths michael@0: */ michael@0: static SkDiscretePathEffect* Create(SkScalar segLength, SkScalar deviation) { michael@0: return SkNEW_ARGS(SkDiscretePathEffect, (segLength, deviation)); michael@0: } michael@0: michael@0: virtual bool filterPath(SkPath* dst, const SkPath& src, michael@0: SkStrokeRec*, const SkRect*) const SK_OVERRIDE; michael@0: michael@0: SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDiscretePathEffect) michael@0: michael@0: protected: michael@0: SkDiscretePathEffect(SkReadBuffer&); michael@0: virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; michael@0: michael@0: #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS michael@0: public: michael@0: #endif michael@0: SkDiscretePathEffect(SkScalar segLength, SkScalar deviation); michael@0: michael@0: private: michael@0: SkScalar fSegLength, fPerterb; michael@0: michael@0: typedef SkPathEffect INHERITED; michael@0: }; michael@0: michael@0: #endif