0.0.2 • Published 3 years ago

lib2geom-path-boolean v0.0.2

Weekly downloads
2
License
ISC
Repository
-
Last release
3 years ago

lib2geom path boolean N-API addon

Exposes lib2geom boolean path algorithms used in the Inkscape project to a node.js project

Installation

As N-API module (recommended)

npm i lib2geom-path-boolean-addon@n-api

With post-install build via cmake-js

npm i -g cmake-js

Debian-based, e.g. Ubuntu

sudo apt-get install g++ cmake libdouble-conversion-dev libgsl-dev libcairo2-dev

Windows (not recommended, linux can build for Windows)

npm i lib2geom-path-boolean-addon

API

intersectPathData

Given 2 strings which are svg d-attributes, returns the d-attribute for the intersection of the two paths

subtractPathData

Given 2 strings which are svg d-attributes, returns the d-attribute for the difference of the two paths

Usage

const { intersectPathData, subtractPathData } = require('lib2geom-path-boolean-addon');

const intersection = intersectPathData('M0,0 L10,0 L10,10 L0,10 Z', 'M5,5 L15,5, L15,15 L5,15 Z');

const subtraction = intersectPathData('M0,0 L10,0 L10,10 L0,10 Z', 'M5,5 L15,5, L15,15 L5,15 Z');