11.0.7 • Published 4 months ago

abstract-image v11.0.7

Weekly downloads
354
License
MIT
Repository
github
Last release
4 months ago

abstract-image

npm version code style: prettier MIT license

Dynamically create images using code or JSX and render to any format

Introduction

Sometimes you need to create an image dynamically, for example when dynamically generating schematics etc. This library makes that easy by providing tools to create an abstract representation of an image which can then be turned into a concrete format such as .png, .svg etc.

Installation

npm install --save abstract-document

The library is compiled to ES5 and no polyfills are required.

Usage

import * as React from "react";
import * as AbstractImage from "abstract-image";

export function AbstractImageExample() {
  const components = [
    AbstractImage.createLine(
      AbstractImage.createPoint(25, 25),
      AbstractImage.createPoint(80, 60),
      AbstractImage.black,
      2
    ),
    AbstractImage.createRectangle(
      AbstractImage.createPoint(10, 50),
      AbstractImage.createPoint(40, 80),
      AbstractImage.blue,
      2,
      AbstractImage.fromArgb(100, 0, 0, 0)
    ),
    AbstractImage.createRectangle(
      AbstractImage.createPoint(60, 50),
      AbstractImage.createPoint(90, 80),
      AbstractImage.blue,
      2,
      AbstractImage.transparent
    ),
  ];
  const image = AbstractImage.createAbstractImage(
    AbstractImage.createPoint(0, 0),
    AbstractImage.createSize(400, 400),
    AbstractImage.white,
    components
  );
  const svg = AbstractImage.createSVG(image);
  return (
    <div>
      <h1>Svg</h1>
      <p>Test</p>
      <pre>{svg}</pre>
      <img width="400" height="400" src={`data:image/svg+xml;,${svg}`} />
    </div>
  );
}

dummy

11.0.7

4 months ago

11.0.5

4 months ago

11.0.4

6 months ago

10.0.5

7 months ago

11.0.2

7 months ago

11.0.3

7 months ago

11.0.1

7 months ago

10.0.0

7 months ago

10.0.2

7 months ago

10.0.3

7 months ago

10.0.4

7 months ago

9.0.2

7 months ago

9.0.1

7 months ago

8.3.1

8 months ago

8.2.2

9 months ago

8.3.0

8 months ago

8.2.1

9 months ago

8.2.0

12 months ago

8.1.3

1 year ago

8.1.2

1 year ago

8.1.0

1 year ago

8.0.1

1 year ago

8.0.0

1 year ago

7.2.3

1 year ago

7.0.1

1 year ago

7.0.0

1 year ago

6.0.1

1 year ago

6.0.0

1 year ago

3.4.3

1 year ago

3.4.1

1 year ago

3.4.0

2 years ago

3.3.3

2 years ago

3.3.0

3 years ago

3.2.6

3 years ago

3.2.5

3 years ago

3.2.4

3 years ago

3.3.2

3 years ago

3.2.3

3 years ago

3.2.1

3 years ago

3.2.0

3 years ago

3.1.3

4 years ago

3.1.2

4 years ago

3.1.1

4 years ago

3.1.0

4 years ago

3.0.0

5 years ago

2.2.6

5 years ago

2.2.5

6 years ago

2.2.4

6 years ago

2.2.3

6 years ago

2.2.1

7 years ago

2.2.0

7 years ago

2.1.5

7 years ago

2.1.4

7 years ago

2.1.3

7 years ago

2.1.2

7 years ago

2.1.1

7 years ago

2.1.0

7 years ago

2.0.0

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago