Giter Club home page Giter Club logo

raqote-deno's Introduction

Raqote Deno

This module has 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

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 for more info.

raqote-deno's People

Contributors

djdeveloperr avatar

Stargazers

Elias Sjögreen avatar  avatar Divy Srivastava avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.