Skia
2D Graphics Library
SkPathMeasure.h
Go to the documentation of this file.
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 SkPathMeasure_DEFINED
9 #define SkPathMeasure_DEFINED
10 
12 #include "include/core/SkPath.h"
13 #include "include/private/SkTDArray.h"
14 
16 public:
24  SkPathMeasure(const SkPath& path, bool forceClosed, SkScalar resScale = 1);
26 
30  void setPath(const SkPath*, bool forceClosed);
31 
36 
42  bool SK_WARN_UNUSED_RESULT getPosTan(SkScalar distance, SkPoint* position,
43  SkVector* tangent);
44 
45  enum MatrixFlags {
46  kGetPosition_MatrixFlag = 0x01,
47  kGetTangent_MatrixFlag = 0x02,
48  kGetPosAndTan_MatrixFlag = kGetPosition_MatrixFlag | kGetTangent_MatrixFlag
49  };
50 
57  MatrixFlags flags = kGetPosAndTan_MatrixFlag);
58 
65  bool getSegment(SkScalar startD, SkScalar stopD, SkPath* dst, bool startWithMoveTo);
66 
69  bool isClosed();
70 
74  bool nextContour();
75 
76 #ifdef SK_DEBUG
77  void dump();
78 #endif
79 
80 private:
82  sk_sp<SkContourMeasure> fContour;
83 
84  SkPathMeasure(const SkPathMeasure&) = delete;
85  SkPathMeasure& operator=(const SkPathMeasure&) = delete;
86 };
87 
88 #endif
SkPathMeasure::getMatrix
bool SK_WARN_UNUSED_RESULT getMatrix(SkScalar distance, SkMatrix *matrix, MatrixFlags flags=kGetPosAndTan_MatrixFlag)
Pins distance to 0 <= distance <= getLength(), and then computes the corresponding matrix (by calling...
SkPathMeasure::isClosed
bool isClosed()
Return true if the current contour is closed()
SkPath
Definition: SkPath.h:44
SkPathMeasure::MatrixFlags
MatrixFlags
Definition: SkPathMeasure.h:45
SkPathMeasure::getSegment
bool getSegment(SkScalar startD, SkScalar stopD, SkPath *dst, bool startWithMoveTo)
Given a start and stop distance, return in dst the intervening segment(s).
sk_sp< SkContourMeasure >
SkPathMeasure::SkPathMeasure
SkPathMeasure(const SkPath &path, bool forceClosed, SkScalar resScale=1)
Initialize the pathmeasure with the specified path.
SkPoint
Definition: SkPoint.h:160
SK_API
#define SK_API
Definition: SkTypes.h:181
SkPathMeasure::getPosTan
bool SK_WARN_UNUSED_RESULT getPosTan(SkScalar distance, SkPoint *position, SkVector *tangent)
Pins distance to 0 <= distance <= getLength(), and then computes the corresponding position and tange...
SkPathMeasure::getLength
SkScalar getLength()
Return the total length of the current contour, or 0 if no path is associated (e.g.
SkContourMeasure.h
SkScalar
float SkScalar
Definition: SkScalar.h:16
SkPath.h
SkPathMeasure::nextContour
bool nextContour()
Move to the next contour in the path.
SkMatrix
Definition: SkMatrix.h:48
SK_WARN_UNUSED_RESULT
#define SK_WARN_UNUSED_RESULT
Definition: SkTypes.h:60
SkPathMeasure::~SkPathMeasure
~SkPathMeasure()
SkContourMeasureIter
Definition: SkContourMeasure.h:91
SkPathMeasure::SkPathMeasure
SkPathMeasure()
SkPathMeasure::setPath
void setPath(const SkPath *, bool forceClosed)
Reset the pathmeasure with the specified path.
SkPathMeasure
Definition: SkPathMeasure.h:15