aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2018-03-07 17:02:47 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-07 22:32:20 +0000
commit4123223ccc85e4f712495403dd1a2869110fd8c4 (patch)
treeccb587567bd48f2a1b77885e92f8a0c44649fff2 /include
parent23d23892cad305117fb8e46bcf8e15c3174c47f4 (diff)
add TrimPathEffect
Bug: skia: Change-Id: I453fb81ded4435b33567e9c8a6f3abe9535d687f Reviewed-on: https://skia-review.googlesource.com/112820 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/effects/SkTrimPathEffect.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/include/effects/SkTrimPathEffect.h b/include/effects/SkTrimPathEffect.h
new file mode 100644
index 0000000000..d40c9e2bbf
--- /dev/null
+++ b/include/effects/SkTrimPathEffect.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2018 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkTrimPathEffect_DEFINED
+#define SkTrimPathEffect_DEFINED
+
+#include "SkPathEffect.h"
+
+class SK_API SkTrimPathEffect {
+public:
+ /**
+ * 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: if startT < stopT, this will return one (logical) segment (even if it is spread
+ * across multiple contours). If startT > stopT, then this will return 2 logical
+ * segments: 0...stopT and startT...1
+ */
+ static sk_sp<SkPathEffect> Make(SkScalar startT, SkScalar stopT);
+};
+
+#endif