Skia
2DGraphicsLibrary
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkDiscretePathEffect.h
1 /*
2  * Copyright 2006 The Android Open Source Project
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef SkDiscretePathEffect_DEFINED
9 #define SkDiscretePathEffect_DEFINED
10 
11 #include "SkPathEffect.h"
12 
17 class SK_API SkDiscretePathEffect : public SkPathEffect {
18 public:
32  static sk_sp<SkPathEffect> Make(SkScalar segLength, SkScalar dev, uint32_t seedAssist = 0);
33 
34 #ifdef SK_SUPPORT_LEGACY_PATHEFFECT_PTR
35  static SkPathEffect* Create(SkScalar segLength, SkScalar deviation, uint32_t seedAssist = 0) {
36  return Make(segLength, deviation, seedAssist).release();
37  }
38 #endif
39 
40  virtual bool filterPath(SkPath* dst, const SkPath& src,
41  SkStrokeRec*, const SkRect*) const override;
42 
43  SK_TO_STRING_OVERRIDE()
44  SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDiscretePathEffect)
45 
46 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
47  bool exposedInAndroidJavaAPI() const override { return true; }
48 #endif
49 
50 protected:
51  SkDiscretePathEffect(SkScalar segLength,
52  SkScalar deviation,
53  uint32_t seedAssist);
54  void flatten(SkWriteBuffer&) const override;
55 
56 private:
57  SkScalar fSegLength, fPerterb;
58 
59  /* Caller-supplied 32 bit seed assist */
60  uint32_t fSeedAssist;
61 
62  typedef SkPathEffect INHERITED;
63 };
64 
65 #endif
T *SK_WARN_UNUSED_RESULT release()
Return the bare pointer, and set the internal object pointer to nullptr.
Definition: SkRefCnt.h:363
The SkPath class encapsulates compound (multiple contour) geometric paths consisting of straight line...
Definition: SkPath.h:27
SkPathEffect is the base class for objects in the SkPaint that affect the geometry of a drawing primi...
Definition: SkPathEffect.h:29
Definition: SkStrokeRec.h:16
Definition: SkRefCnt.h:135
virtual bool filterPath(SkPath *dst, const SkPath &src, SkStrokeRec *, const SkRect *cullR) const =0
Given a src path (input) and a stroke-rec (input and output), apply this effect to the src path...
This path effect chops a path into discrete segments, and randomly displaces them.
Definition: SkDiscretePathEffect.h:17
Definition: SkWriteBuffer.h:26
Definition: SkRect.h:390
virtual void flatten(SkWriteBuffer &) const
Override this if your subclass needs to record data that it will need to recreate itself from its Cre...
Definition: SkFlattenable.h:117