2008-12-17 15:59:43 +00:00
|
|
|
/*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Copyright 2006 The Android Open Source Project
|
2008-12-17 15:59:43 +00:00
|
|
|
*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
2008-12-17 15:59:43 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SkDiscretePathEffect_DEFINED
|
|
|
|
#define SkDiscretePathEffect_DEFINED
|
|
|
|
|
|
|
|
#include "SkPathEffect.h"
|
|
|
|
|
|
|
|
/** \class SkDiscretePathEffect
|
|
|
|
|
|
|
|
This path effect chops a path into discrete segments, and randomly displaces them.
|
|
|
|
*/
|
2012-10-12 14:41:39 +00:00
|
|
|
class SK_API SkDiscretePathEffect : public SkPathEffect {
|
2008-12-17 15:59:43 +00:00
|
|
|
public:
|
|
|
|
/** Break the path into segments of segLength length, and randomly move the endpoints
|
|
|
|
away from the original path by a maximum of deviation.
|
|
|
|
Note: works on filled or framed paths
|
|
|
|
*/
|
|
|
|
SkDiscretePathEffect(SkScalar segLength, SkScalar deviation);
|
|
|
|
|
2012-12-18 16:12:09 +00:00
|
|
|
virtual bool filterPath(SkPath* dst, const SkPath& src,
|
2013-01-24 21:03:11 +00:00
|
|
|
SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
|
2008-12-17 15:59:43 +00:00
|
|
|
|
2012-03-26 17:57:35 +00:00
|
|
|
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDiscretePathEffect)
|
2011-06-21 19:24:00 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
protected:
|
|
|
|
SkDiscretePathEffect(SkFlattenableReadBuffer&);
|
2012-03-29 15:18:04 +00:00
|
|
|
virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
|
2008-12-17 15:59:43 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
SkScalar fSegLength, fPerterb;
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
typedef SkPathEffect INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|