Flutter Engine
The Flutter Engine
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Types | Static Public Member Functions | List of all members
SkTrimPathEffect Class Reference

#include <SkTrimPathEffect.h>

Public Types

enum class  Mode { kNormal , kInverted }
 

Static Public Member Functions

static sk_sp< SkPathEffectMake (SkScalar startT, SkScalar stopT, Mode=Mode::kNormal)
 

Detailed Description

Definition at line 17 of file SkTrimPathEffect.h.

Member Enumeration Documentation

◆ Mode

enum class SkTrimPathEffect::Mode
strong
Enumerator
kNormal 
kInverted 

Definition at line 19 of file SkTrimPathEffect.h.

19 {
20 kNormal, // return the subset path [start,stop]
21 kInverted, // return the complement/subset paths [0,start] + [stop,1]
22 };
@ kNormal
Default priority level.
Definition: embedder.h:262

Member Function Documentation

◆ Make()

sk_sp< SkPathEffect > SkTrimPathEffect::Make ( SkScalar  startT,
SkScalar  stopT,
Mode  mode = Mode::kNormal 
)
static

Take start and stop "t" values (values between 0...1), and return a path that is that subset of the original path.

e.g. Make(0.5, 1.0) --> return the 2nd half of the path Make(0.33333, 0.66667) --> return the middle third of the path

The trim values apply to the entire path, so if it contains several contours, all of them are including in the calculation.

startT and stopT must be 0..1 inclusive. If they are outside of that interval, they will be pinned to the nearest legal value. If either is NaN, null will be returned.

Note: for Mode::kNormal, this will return one (logical) segment (even if it is spread across multiple contours). For Mode::kInverted, this will return 2 logical segments: stopT..1 and 0...startT, in this order.

Definition at line 133 of file SkTrimPathEffect.cpp.

133 {
134 if (!SkIsFinite(startT, stopT)) {
135 return nullptr;
136 }
137
138 if (startT <= 0 && stopT >= 1 && mode == Mode::kNormal) {
139 return nullptr;
140 }
141
142 startT = SkTPin(startT, 0.f, 1.f);
143 stopT = SkTPin(stopT, 0.f, 1.f);
144
145 if (startT >= stopT && mode == Mode::kInverted) {
146 return nullptr;
147 }
148
149 return sk_sp<SkPathEffect>(new SkTrimPE(startT, stopT, mode));
150}
static bool SkIsFinite(T x, Pack... values)
static constexpr const T & SkTPin(const T &x, const T &lo, const T &hi)
Definition: SkTPin.h:19
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition: switches.h:228

The documentation for this class was generated from the following files: