Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
include
core
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
11
#include "
include/core/SkContourMeasure.h
"
12
#include "
include/core/SkPoint.h
"
13
#include "
include/core/SkRefCnt.h
"
14
#include "
include/core/SkScalar.h
"
15
#include "
include/private/base/SkAPI.h
"
16
17
class
SkMatrix
;
18
class
SkPath
;
19
20
class
SK_API
SkPathMeasure
{
21
public
:
22
SkPathMeasure
();
23
/** Initialize the pathmeasure with the specified path. The parts of the path that are needed
24
* are copied, so the client is free to modify/delete the path after this call.
25
*
26
* resScale controls the precision of the measure. values > 1 increase the
27
* precision (and possibly slow down the computation).
28
*/
29
SkPathMeasure
(
const
SkPath
& path,
bool
forceClosed,
SkScalar
resScale = 1);
30
~SkPathMeasure
();
31
32
SkPathMeasure
(
SkPathMeasure
&&) =
default
;
33
SkPathMeasure
&
operator=
(
SkPathMeasure
&&) =
default
;
34
35
/** Reset the pathmeasure with the specified path. The parts of the path that are needed
36
* are copied, so the client is free to modify/delete the path after this call..
37
*/
38
void
setPath(
const
SkPath
*,
bool
forceClosed);
39
40
/** Return the total length of the current contour, or 0 if no path
41
is associated (e.g. resetPath(null))
42
*/
43
SkScalar
getLength();
44
45
/** Pins distance to 0 <= distance <= getLength(), and then computes
46
the corresponding position and tangent.
47
Returns false if there is no path, or a zero-length path was specified, in which case
48
position and tangent are unchanged.
49
*/
50
[[nodiscard]]
bool
getPosTan(
SkScalar
distance,
SkPoint
* position,
SkVector
* tangent);
51
52
enum
MatrixFlags
{
53
kGetPosition_MatrixFlag = 0x01,
54
kGetTangent_MatrixFlag = 0x02,
55
kGetPosAndTan_MatrixFlag = kGetPosition_MatrixFlag | kGetTangent_MatrixFlag
56
};
57
58
/** Pins distance to 0 <= distance <= getLength(), and then computes
59
the corresponding matrix (by calling getPosTan).
60
Returns false if there is no path, or a zero-length path was specified, in which case
61
matrix is unchanged.
62
*/
63
[[nodiscard]]
bool
getMatrix(
SkScalar
distance,
SkMatrix
* matrix,
64
MatrixFlags
flags
= kGetPosAndTan_MatrixFlag);
65
66
/** Given a start and stop distance, return in dst the intervening segment(s).
67
If the segment is zero-length, return false, else return true.
68
startD and stopD are pinned to legal values (0..getLength()). If startD > stopD
69
then return false (and leave dst untouched).
70
Begin the segment with a moveTo if startWithMoveTo is true
71
*/
72
bool
getSegment(
SkScalar
startD,
SkScalar
stopD,
SkPath
* dst,
bool
startWithMoveTo);
73
74
/** Return true if the current contour is closed()
75
*/
76
bool
isClosed();
77
78
/** Move to the next contour in the path. Return true if one exists, or false if
79
we're done with the path.
80
*/
81
bool
nextContour();
82
83
#ifdef SK_DEBUG
84
void
dump
();
85
#endif
86
87
const
SkContourMeasure
*
currentMeasure
()
const
{
return
fContour.get(); }
88
89
private
:
90
SkContourMeasureIter
fIter
;
91
sk_sp<SkContourMeasure>
fContour;
92
};
93
94
#endif
fIter
std::unique_ptr< SkLatticeIter > fIter
Definition
LatticeOp.cpp:380
SkAPI.h
SK_API
#define SK_API
Definition
SkAPI.h:35
SkContourMeasure.h
SkPoint.h
SkRefCnt.h
SkScalar.h
dump
static void dump(const float m[20], SkYUVColorSpace cs, bool rgb2yuv)
Definition
SkYUVMath.cpp:629
SkContourMeasureIter
Definition
SkContourMeasure.h:96
SkContourMeasure
Definition
SkContourMeasure.h:22
SkMatrix
Definition
SkMatrix.h:54
SkPathMeasure
Definition
SkPathMeasure.h:20
SkPathMeasure::operator=
SkPathMeasure & operator=(SkPathMeasure &&)=default
SkPathMeasure::SkPathMeasure
SkPathMeasure(SkPathMeasure &&)=default
SkPathMeasure::MatrixFlags
MatrixFlags
Definition
SkPathMeasure.h:52
SkPathMeasure::currentMeasure
const SkContourMeasure * currentMeasure() const
Definition
SkPathMeasure.h:87
SkPath
Definition
SkPath.h:59
sk_sp
Definition
SkRefCnt.h:220
SkScalar
float SkScalar
Definition
extension.cpp:12
flags
FlutterSemanticsFlag flags
Definition
fl_accessible_node.cc:105
SkPoint
Definition
SkPoint_impl.h:163
Generated on Fri Apr 26 2024 06:16:10 for Flutter Engine by
1.9.8