1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/include/effects/SkDiscretePathEffect.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,47 @@ 1.4 +/* 1.5 + * Copyright 2006 The Android Open Source Project 1.6 + * 1.7 + * Use of this source code is governed by a BSD-style license that can be 1.8 + * found in the LICENSE file. 1.9 + */ 1.10 + 1.11 +#ifndef SkDiscretePathEffect_DEFINED 1.12 +#define SkDiscretePathEffect_DEFINED 1.13 + 1.14 +#include "SkPathEffect.h" 1.15 + 1.16 +/** \class SkDiscretePathEffect 1.17 + 1.18 + This path effect chops a path into discrete segments, and randomly displaces them. 1.19 +*/ 1.20 +class SK_API SkDiscretePathEffect : public SkPathEffect { 1.21 +public: 1.22 + /** Break the path into segments of segLength length, and randomly move the endpoints 1.23 + away from the original path by a maximum of deviation. 1.24 + Note: works on filled or framed paths 1.25 + */ 1.26 + static SkDiscretePathEffect* Create(SkScalar segLength, SkScalar deviation) { 1.27 + return SkNEW_ARGS(SkDiscretePathEffect, (segLength, deviation)); 1.28 + } 1.29 + 1.30 + virtual bool filterPath(SkPath* dst, const SkPath& src, 1.31 + SkStrokeRec*, const SkRect*) const SK_OVERRIDE; 1.32 + 1.33 + SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDiscretePathEffect) 1.34 + 1.35 +protected: 1.36 + SkDiscretePathEffect(SkReadBuffer&); 1.37 + virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 1.38 + 1.39 +#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS 1.40 +public: 1.41 +#endif 1.42 + SkDiscretePathEffect(SkScalar segLength, SkScalar deviation); 1.43 + 1.44 +private: 1.45 + SkScalar fSegLength, fPerterb; 1.46 + 1.47 + typedef SkPathEffect INHERITED; 1.48 +}; 1.49 + 1.50 +#endif