blob: a2934def43b6f6e044e6df51d674226917fa3945 [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 SkDiscretePathEffect_DEFINED
11#define SkDiscretePathEffect_DEFINED
12
13#include "SkPathEffect.h"
14
15/** \class SkDiscretePathEffect
16
17 This path effect chops a path into discrete segments, and randomly displaces them.
18*/
19class SkDiscretePathEffect : public SkPathEffect {
20public:
21 /** Break the path into segments of segLength length, and randomly move the endpoints
22 away from the original path by a maximum of deviation.
23 Note: works on filled or framed paths
24 */
25 SkDiscretePathEffect(SkScalar segLength, SkScalar deviation);
26
reed@google.comfd4be262012-05-25 01:04:12 +000027 virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*) SK_OVERRIDE;
reed@android.com8a1c16f2008-12-17 15:59:43 +000028
djsollen@google.comba28d032012-03-26 17:57:35 +000029 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDiscretePathEffect)
reed@google.com6bac9472011-06-21 19:24:00 +000030
reed@android.com8a1c16f2008-12-17 15:59:43 +000031protected:
32 SkDiscretePathEffect(SkFlattenableReadBuffer&);
djsollen@google.com54924242012-03-29 15:18:04 +000033 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
reed@android.com8a1c16f2008-12-17 15:59:43 +000034
35private:
36 SkScalar fSegLength, fPerterb;
rmistry@google.comfbfcd562012-08-23 18:09:54 +000037
reed@android.com8a1c16f2008-12-17 15:59:43 +000038 typedef SkPathEffect INHERITED;
39};
40
41#endif
42