Skia
2DGraphicsLibrary
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkDashPathEffect.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 SkDashPathEffect_DEFINED
9 #define SkDashPathEffect_DEFINED
10 
11 #include "SkPathEffect.h"
12 
17 class SK_API SkDashPathEffect : public SkPathEffect {
18 public:
39  static sk_sp<SkPathEffect> Make(const SkScalar intervals[], int count, SkScalar phase);
40 
41 #ifdef SK_SUPPORT_LEGACY_PATHEFFECT_PTR
42  static SkPathEffect* Create(const SkScalar intervals[], int count, SkScalar phase) {
43  return Make(intervals, count, phase).release();
44  }
45 #endif
46 
47  virtual bool filterPath(SkPath* dst, const SkPath& src,
48  SkStrokeRec*, const SkRect*) const override;
49 
50  virtual bool asPoints(PointData* results, const SkPath& src,
51  const SkStrokeRec&, const SkMatrix&,
52  const SkRect*) const override;
53 
54  DashType asADash(DashInfo* info) const override;
55 
56  SK_TO_STRING_OVERRIDE()
57  SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDashPathEffect)
58 
59 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
60  bool exposedInAndroidJavaAPI() const override { return true; }
61 #endif
62 
63 protected:
64  virtual ~SkDashPathEffect();
65  SkDashPathEffect(const SkScalar intervals[], int count, SkScalar phase);
66  void flatten(SkWriteBuffer&) const override;
67 
68 private:
69  SkScalar* fIntervals;
70  int32_t fCount;
71  SkScalar fPhase;
72  // computed from phase
73 
74  SkScalar fInitialDashLength;
75  int32_t fInitialDashIndex;
76  SkScalar fIntervalLength;
77 
78  typedef SkPathEffect INHERITED;
79 };
80 
81 #endif
T *SK_WARN_UNUSED_RESULT release()
Return the bare pointer, and set the internal object pointer to nullptr.
Definition: SkRefCnt.h:363
Definition: SkPathEffect.h:119
SkDashPathEffect is a subclass of SkPathEffect that implements dashing.
Definition: SkDashPathEffect.h:17
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
DashType
If the PathEffect can be represented as a dash pattern, asADash will return kDash_DashType and None o...
Definition: SkPathEffect.h:114
Definition: SkStrokeRec.h:16
The SkMatrix class holds a 3x3 matrix for transforming coordinates.
Definition: SkMatrix.h:26
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...
Definition: SkWriteBuffer.h:26
Definition: SkRect.h:390
virtual bool asPoints(PointData *results, const SkPath &src, const SkStrokeRec &, const SkMatrix &, const SkRect *cullR) const
Does applying this path effect to 'src' yield a set of points? If so, optionally return the points in...
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
PointData aggregates all the information needed to draw the point primitives returned by an 'asPoints...
Definition: SkPathEffect.h:60