MCPcopy Create free account
hub / github.com/JetBrains/skija / Path

Class Path

shared/java/Path.java:26–2032  ·  view source on GitHub ↗

Path contain geometry. Path may be empty, or contain one or more verbs that outline a figure. Path always starts with a move verb to a Cartesian coordinate, and may be followed by additional verbs that add lines or curves. Adding a close verb makes the geometry into a continuous loop, a c

Source from the content-addressed store, hash-verified

24 * {@link #updateBoundsCache()} to make Path thread safe.</p>
25 */
26public class Path extends Managed implements Iterable<PathSegment> {
27 static { Library.staticLoad(); }
28
29 @ApiStatus.Internal
30 public static class _FinalizerHolder {
31 public static final long PTR = _nGetFinalizer();
32 }
33
34 /**
35 * Constructs an empty Path. By default, Path has no verbs, no {@link Point}, and no weights.
36 * FillMode is set to {@link PathFillMode#WINDING}.
37 */
38 public Path() {
39 this(_nMake());
40 Stats.onNativeCall();
41 }
42
43 @NotNull
44 public static Path makeFromSVGString(String svg) {
45 long res = _nMakeFromSVGString(svg);
46 if (res == 0)
47 throw new IllegalArgumentException("Failed to parse SVG Path string: " + svg);
48 else
49 return new Path(res);
50 }
51
52 /**
53 * Compares this path and o; Returns true if {@link PathFillMode}, verb array, Point array, and weights
54 * are equivalent.
55 *
56 * @param other Path to compare
57 * @return true if this and Path are equivalent
58 */
59 @ApiStatus.Internal @Override
60 public boolean _nativeEquals(Native other) {
61 try {
62 return _nEquals(_ptr, Native.getPtr(other));
63 } finally {
64 Reference.reachabilityFence(this);
65 Reference.reachabilityFence(other);
66 }
67 }
68
69 /**
70 * <p>Returns true if Path contain equal verbs and equal weights.
71 * If Path contain one or more conics, the weights must match.</p>
72 *
73 * <p>{@link #conicTo(float, float, float, float, float)} may add different verbs
74 * depending on conic weight, so it is not trivial to interpolate a pair of Path
75 * containing conics with different conic weight values.</p>
76 *
77 * @param compare Path to compare
78 * @return true if Path verb array and weights are equivalent
79 *
80 * @see <a href="https://fiddle.skia.org/c/@Path_isInterpolatable">https://fiddle.skia.org/c/@Path_isInterpolatable</a>
81 */
82 public boolean isInterpolatable(Path compare) {
83 try {

Callers

nothing calls this directly

Calls 1

staticLoadMethod · 0.95

Tested by

no test coverage detected