tiny-svg 1.0.0

Tiny SVG library for drawing and quick experiments


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

<img src="imgs/icon-tsvg.png" width="95" height="52" align="left"></img>

Tiny SVG

A tiny SVG library for drawing and quick experiments. No dependencies.

Quick example

SVGCanvas canvas = SVGCanvas(240, 240);

// add gradient
new RadialGradient("rg0", Colors.gold, Colors.orange)
    .setOpacityA(0.4)
    .setOpacityB(0.9)
    .addToCanvas(canvas);

// draw
new Rectangle(0, 0, canvas.width, canvas.height)
    .setStrokeColor(Colors.blue)
    .setStrokeWidth(0)
    .setGradient("rg0")
    .addToCanvas(canvas);

new Circle(canvas.width / 3, canvas.height / 3, 24)
    .setFillColor(Colors.white)
    .addToCanvas(canvas);

new Circle(canvas.width * 2 / 3, canvas.height / 3, 24)
    .setFillColor(Colors.white)
    .addToCanvas(canvas);

new Curve(canvas.width / 3, canvas.height * 2 / 3, canvas.width * 2 / 3, canvas.height * 2 / 3)
    .setFillColor(Colors.white)
    .addToCanvas(canvas);

// save
canvas.save("examples/example.svg");

Output:

<img src="examples/example.svg" width="240">

Example (origami bird)

<img src="examples/origami_bird.svg" width="720">

Code can be found here.

Authors:
  • rillki
Dependencies:
none
Versions:
1.0.1 2023-Aug-09
1.0.0 2023-Aug-03
~main 2023-Sep-06
Show all 3 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 12 downloads total

Score:
0.1
Short URL:
tiny-svg.dub.pm