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
| 24 | * {@link #updateBoundsCache()} to make Path thread safe.</p> |
| 25 | */ |
| 26 | public 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 | @NotNull @Contract("_, _, _, _ -> new") |
| 35 | public static Path makeRaw(@NotNull Point[] points, @NotNull PathVerb[] verbs, @NotNull float[] conicWeights, @NotNull PathFillMode fillMode) { |
| 36 | return makeRaw(points, verbs, conicWeights, fillMode, false); |
| 37 | } |
| 38 | |
| 39 | @NotNull @Contract("_, _, _, _, _ -> new") |
| 40 | public static Path makeRaw(@NotNull Point[] points, @NotNull PathVerb[] verbs, @NotNull float[] conicWeights, @NotNull PathFillMode fillMode, boolean isVolatile) { |
| 41 | Stats.onNativeCall(); |
| 42 | int[] verbOrdinals = new int[verbs.length]; |
| 43 | for (int i = 0; i < verbs.length; i++) { |
| 44 | verbOrdinals[i] = verbs[i].ordinal(); |
| 45 | } |
| 46 | float[] coords = new float[points.length * 2]; |
| 47 | for (int i = 0; i < points.length; i++) { |
| 48 | coords[i * 2] = points[i]._x; |
| 49 | coords[i * 2 + 1] = points[i]._y; |
| 50 | } |
| 51 | return new Path(_nMakeRaw(coords, verbOrdinals, conicWeights, fillMode.ordinal(), isVolatile)); |
| 52 | } |
| 53 | |
| 54 | @NotNull @Contract("_ -> new") |
| 55 | public static Path makeRect(@NotNull Rect rect) { |
| 56 | return makeRect(rect, PathDirection.CLOCKWISE, 0); |
| 57 | } |
| 58 | |
| 59 | @NotNull @Contract("_, _ -> new") |
| 60 | public static Path makeRect(@NotNull Rect rect, @NotNull PathDirection dir) { |
| 61 | return makeRect(rect, dir, 0); |
| 62 | } |
| 63 | |
| 64 | @NotNull @Contract("_, _, _ -> new") |
| 65 | public static Path makeRect(@NotNull Rect rect, @NotNull PathDirection dir, int startIndex) { |
| 66 | Stats.onNativeCall(); |
| 67 | return new Path(_nMakeRect(rect._left, rect._top, rect._right, rect._bottom, dir.ordinal(), startIndex)); |
| 68 | } |
| 69 | |
| 70 | @NotNull @Contract("_ -> new") |
| 71 | public static Path makeOval(@NotNull Rect oval) { |
| 72 | return makeOval(oval, PathDirection.CLOCKWISE); |
| 73 | } |
| 74 | |
| 75 | @NotNull @Contract("_, _ -> new") |
| 76 | public static Path makeOval(@NotNull Rect oval, @NotNull PathDirection dir) { |
| 77 | Stats.onNativeCall(); |
| 78 | return new Path(_nMakeOval(oval._left, oval._top, oval._right, oval._bottom, dir.ordinal())); |
| 79 | } |
| 80 | |
| 81 | @NotNull @Contract("_, _, _ -> new") |
| 82 | public static Path makeCircle(float x, float y, float radius) { |
| 83 | return makeCircle(x, y, radius, PathDirection.CLOCKWISE); |