本文整理匯總了Java中android.graphics.Path.set方法的典型用法代碼示例。如果您正苦於以下問題:Java Path.set方法的具體用法?Java Path.set怎麽用?Java Path.set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.graphics.Path
的用法示例。
在下文中一共展示了Path.set方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getViewPathWithOffsetAt
import android.graphics.Path; //導入方法依賴的package包/類
private Path getViewPathWithOffsetAt(int position) {
Path noOffsetPath = viewPaths.get(position);
if (noOffsetPath == null) {
return null;
}
Path path = new Path();
path.set(noOffsetPath);
path.offset(offsetX, offsetY);
return path;
}
示例2: applyTrimPathIfNeeded
import android.graphics.Path; //導入方法依賴的package包/類
static void applyTrimPathIfNeeded(Path path, @Nullable TrimPathContent trimPath) {
if (trimPath == null) {
return;
}
pathMeasure.setPath(path, false);
float length = pathMeasure.getLength();
float start = length * trimPath.getStart().getValue() / 100f;
float end = length * trimPath.getEnd().getValue() / 100f;
float newStart = Math.min(start, end);
float newEnd = Math.max(start, end);
float offset = trimPath.getOffset().getValue() / 360f * length;
newStart += offset;
newEnd += offset;
// If the trim path has rotated around the path, we need to shift it back.
if (newStart > length && newEnd > length) {
newStart %= length;
newEnd %= length;
}
if (newStart > newEnd) {
newStart -= length;
}
tempPath.reset();
pathMeasure.getSegment(
newStart,
newEnd,
tempPath,
true);
if (newEnd > length) {
tempPath2.reset();
pathMeasure.getSegment(
0,
newEnd % length,
tempPath2,
true);
tempPath.addPath(tempPath2);
} else if (newStart < 0) {
tempPath2.reset();
pathMeasure.getSegment(
length + newStart,
length,
tempPath2,
true);
tempPath.addPath(tempPath2);
}
path.set(tempPath);
}