Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/djdeveloperr/raqote-deno
Raqote bindings for Deno.
https://github.com/djdeveloperr/raqote-deno
2d canvas deno drawing graphics raqote rust typescript
Last synced: 16 days ago
JSON representation
Raqote bindings for Deno.
- Host: GitHub
- URL: https://github.com/djdeveloperr/raqote-deno
- Owner: DjDeveloperr
- License: mit
- Created: 2021-01-10T06:22:12.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-03-29T06:52:13.000Z (over 3 years ago)
- Last Synced: 2024-10-26T06:52:16.606Z (20 days ago)
- Topics: 2d, canvas, deno, drawing, graphics, raqote, rust, typescript
- Language: Rust
- Homepage:
- Size: 49.8 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Raqote Deno
This module has [Raqote](https://github.com/jrmuizel/raqote) (a 2D graphics library for Rust) bindings for Deno using (unstable) Plugin API.
## Note
This is a Work In Progress, so no binary for the plugin is published yet. So if you want to give it a try, you may build it and use!
## Usage
```ts
const dt = new DrawTarget(400, 400);
const gradient = Source.createRadialGradient(
new Gradient()
.addStop(0.2, new Color(0xff, 0, 0xff, 0))
.addStop(0.8, new Color(0xff, 0xff, 0xff, 0xff))
.addStop(1, new Color(0xff, 0xff, 0, 0xff))
.stops,
new Point(150, 150),
128,
Spread.Pad
);dt.fill(
new PathBuilder()
.moveTo(100, 10)
.cubicTo(150, 40, 175, 0, 200, 10)
.quadTo(120, 100, 80, 200)
.quadTo(150, 180, 300, 300)
.close(),
gradient
);dt.stroke(
new PathBuilder()
.moveTo(100, 100)
.lineTo(300, 300)
.lineTo(200, 300),
{
cap: LineCap.Round,
join: LineJoin.Round,
width: 10,
miter_limit: 2,
dash_array: [10, 18],
dash_offset: 16,
},
Source.Solid(new Color(0x80, 0x0, 0x0, 0x80))
);dt.writePNG("example.png");
```(Yes this is the same example from Raqote README but in TS :p)
## Contributing
You're always welcome to contribute!
- We use `deno fmt` to format the files.
## License
See [LICENSE](LICENSE) for more info.