Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue fill path #22

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# SVGCanvas

** Aha! note: the current branch for all builds is `issue-fill-path` **

Draw on SVG using Canvas's 2D Context API. A maintained fork of
[gliffy's canvas2svg](https://github.com/gliffy/canvas2svg).

Expand Down Expand Up @@ -61,10 +63,38 @@ dom.wrapper; // a div with the svg as a child
dom.svg; // the inline svg element
```

Working with paths directly:

```javascript
import { Context, Path2D } from "svgcanvas";

const ctx = new Context(500, 500);

// Create a path:
const path = new Path2D(ctx, "M 230 80 L 275 80 Z"); // or ctx.createPath("M 230 80 L 275 80 Z");
ctx.stroke(path);

// serialize your SVG
const mySerializedSVG = ctx.getSerializedSvg();
```

## Tests

https://zenozeng.github.io/p5.js-svg/test/

To run the testsuite:

```
npm run test
```

To debug tests in a browser:

```
open test/index.html
npm run watch
```

## License

This library is licensed under the MIT license.
Loading