diff options
author | 2016-02-18 04:11:48 -0800 | |
---|---|---|
committer | 2016-02-18 04:11:49 -0800 | |
commit | 8e7b19d0f04f286ec283747ec128e9696c842858 (patch) | |
tree | 61cc65ef71e223b93f09775d6e603161ed5f2360 /include/core/SkPath.h | |
parent | c5eddd7d8d67a6e931973a729c5868c155cb751f (diff) |
add interp path
Add path methods to determine if a pair of paths
can be interpolated, and to interpolate them.
R=reed@google.com, robertphillips@google.com
BUG=skia:4549
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1703943003
Review URL: https://codereview.chromium.org/1703943003
Diffstat (limited to 'include/core/SkPath.h')
-rw-r--r-- | include/core/SkPath.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/core/SkPath.h b/include/core/SkPath.h index 9fd7d983cf..6d01f8d162 100644 --- a/include/core/SkPath.h +++ b/include/core/SkPath.h @@ -37,6 +37,27 @@ public: return !(a == b); } + /** Return true if the paths contain an equal array of verbs and weights. Paths + * with equal verb counts can be readily interpolated. If the paths contain one + * or more conics, the conics' weights must also match. + * + * @param compare The path to compare. + * + * @return true if the paths have the same verbs and weights. + */ + bool isInterpolatable(const SkPath& compare) const; + + /** Interpolate between two paths with same-sized point arrays. + * The out path contains the verbs and weights of this path. + * The out points are a weighted average of this path and the ending path. + * + * @param ending The path to interpolate between. + * @param weight The weight, from 0 to 1. The output points are set to + * (this->points * weight) + ending->points * (1 - weight). + * @return true if the paths could be interpolated. + */ + bool interpolate(const SkPath& ending, SkScalar weight, SkPath* out) const; + #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK /** Returns true if the caller is the only owner of the underlying path data */ bool unique() const { return fPathRef->unique(); } |