• Home
  • Raw
  • Download

Lines Matching refs:PathKit

1 PathKit - Geometry in the Browser
10 PathKit is still under rapid development, so the exact API is subject to change.
42 console.log('WebAssembly is supported! Using the wasm version of PathKit');
45 …sole.log('WebAssembly is not supported (yet) on this browser. Using the asmjs version of PathKit');
53 }).ready().then((PathKit) => {
54 // Code goes here using PathKit
55 PathEffectsExample(PathKit);
56 MatrixTransformExample(PathKit);
83 function PathEffectsExample(PathKit) {
97 join: PathKit.StrokeJoin.BEVEL,
98 cap: PathKit.StrokeCap.BUTT,
106 join: PathKit.StrokeJoin.ROUND,
107 cap: PathKit.StrokeCap.SQUARE,
109 .op(orig, PathKit.PathOp.DIFFERENCE);
116 join: PathKit.StrokeJoin.BEVEL,
117 cap: PathKit.StrokeCap.BUTT,
119 .op(simplified, PathKit.PathOp.REVERSE_DIFFERENCE);
130 let path = PathKit.NewPath();
163 function MatrixTransformExample(PathKit) {
169 let path = drawStar(PathKit.NewPath());
207 The best place to look for examples on how to use PathKit would be in the
228 - From the SVG string of a path `PathKit.FromSVGString(str)`
229 - From a 2D array of verbs and arguments `PathKit.FromCmds(cmds)`
230 - From `PathKit.NewPath()` (It will be blank)
231 - As a copy of an existing `SkPath` with `path.copy()` or `PathKit.NewPath(path)`
243PathKit.MakeFromOp(p1, p2, op)`. For example, `path1.op(path2, PathKit.PathOp.INTERSECT)` will se…
252 ### PathKit ### subsection
261 let path = PathKit.FromSVGString('M150 0 L75 200 L225 200 Z');
276 [PathKit.MOVE_VERB, 0, 10],
277 [PathKit.LINE_VERB, 30, 40],
278 [PathKit.QUAD_VERB, 20, 50, 45, 60],
280 let path = PathKit.FromCmds(cmds);
282 // let path = PathKit.NewPath().moveTo(0, 10).lineTo(30, 40).quadTo(20, 50, 45, 60);
291 let path = PathKit.NewPath();
296 // Users can also do let path = new PathKit.SkPath();
306 let clone = PathKit.NewPath(otherPath);
309 // Users can also do let clone = new PathKit.SkPath(otherPath);
322 let pathOne = PathKit.NewPath().moveTo(0, 20).lineTo(10, 10).lineTo(20, 20).close();
323 let pathTwo = PathKit.NewPath().moveTo(10, 20).lineTo(20, 10).lineTo(30, 20).close();
324 let mountains = PathKit.MakeFromOp(pathOne, pathTwo, PathKit.PathOp.UNION);
326 // Users can also do pathOne.op(pathTwo, PathKit.PathOp.UNION);
384 let box = PathKit.NewPath().rect(0, 0, 100, 100);
385 let moreBoxes = PathKit.NewPath();
410 let box = PathKit.NewPath().rect(0, 0, 100, 100);
411 let moreBoxes = PathKit.NewPath();
439 let path = PathKit.NewPath();
493 let box = PathKit.NewPath().rect(0, 0, 100, 100);
528 `PathKit.FillType.WINDING`, but may change with `op()` or `simplify()`.
568 let pathOne = PathKit.NewPath().moveTo(0, 20).lineTo(10, 10).lineTo(20, 20).close();
569 let pathTwo = PathKit.NewPath().moveTo(10, 20).lineTo(20, 10).lineTo(30, 20).close();
571 let mountains = pathOne.copy().op(pathOne, pathTwo, PathKit.PathOp.UNION);
573 pathOne.op(pathOne, pathTwo, PathKit.PathOp.INTERSECT);
611 let box = PathKit.NewPath().rect(0, 0, 100, 100);
613 let rounded = box.copy().stroke({width: 10, join: PathKit.StrokeJoin.ROUND});
615 let grow = box.copy().stroke({width: 20}).op(box, PathKit.PathOp.DIFFERENCE);
618 let shrink = box.copy().stroke({width: 15, cap: PathKit.StrokeCap.BUTT})
619 .op(simplified, PathKit.PathOp.REVERSE_DIFFERENCE);
630 let box = PathKit.NewPath().rect(0, 0, 100, 100);
639 Returns a 2D Array of verbs and args. See `PathKit.FromCmds()` for
649 let box = PathKit.NewPath().rect(0, 0, 100, 100);
660 let box = PathKit.NewPath().rect(0, 0, 100, 100);
683 let path = PathKit.NewPath().rect(0, 0, 100, 100);
704 let box = PathKit.NewPath().rect(0, 0, 100, 100);
712 Create one with `let builder = new PathKit.SkOpBuilder();`
752 - **join**, `StrokeJoin`, the join to use. Default `PathKit.StrokeJoin.MITER`.
754 - **cap**, `StrokeCap`, the cap to use. Default `PathKit.StrokeCap.BUTT`.
761 - `PathKit.PathOp.DIFFERENCE`
762 - `PathKit.PathOp.INTERSECT`
763 - `PathKit.PathOp.REVERSE_DIFFERENCE`
764 - `PathKit.PathOp.UNION`
765 - `PathKit.PathOp.XOR`
767 These are used in `PathKit.MakeFromOp()` and `SkPath.op()`.
773 - `PathKit.FillType.WINDING` (also known as nonzero)
774 - `PathKit.FillType.EVENODD`
775 - `PathKit.FillType.INVERSE_WINDING`
776 - `PathKit.FillType.INVERSE_EVENODD`
785 - `PathKit.StrokeJoin.MITER`
786 - `PathKit.StrokeJoin.ROUND`
787 - `PathKit.StrokeJoin.BEVEL`
795 - `PathKit.StrokeCap.BUTT`
796 - `PathKit.StrokeCap.ROUND`
797 - `PathKit.StrokeCap.SQUARE`
804 - `PathKit.MOVE_VERB` = 0
805 - `PathKit.LINE_VERB` = 1
806 - `PathKit.QUAD_VERB` = 2
807 - `PathKit.CONIC_VERB` = 3
808 - `PathKit.CUBIC_VERB` = 4
809 - `PathKit.CLOSE_VERB` = 5
811 These are only needed for `PathKit.FromCmds()`.
815 #### `PathKit.LTRBRect(left, top, right, bottom)` ####