Files
rough/bin/rough.js
2018-06-18 13:08:58 -07:00

30 lines
928 B
JavaScript

import { RoughCanvas } from './canvas';
import { RoughGenerator } from './generator';
import { RoughGeneratorAsync } from './generator-async';
import { RoughCanvasAsync } from './canvas-async';
import { RoughSVG } from './svg';
import { RoughSVGAsync } from './svg-async';
export default {
canvas(canvas, config) {
if (config && config.async) {
return new RoughCanvasAsync(canvas, config);
}
return new RoughCanvas(canvas, config);
},
svg(svg, config) {
if (config && config.async) {
return new RoughSVGAsync(svg, config);
}
return new RoughSVG(svg, config);
},
createRenderer() {
return RoughCanvas.createRenderer();
},
generator(config, surface) {
if (config && config.async) {
return new RoughGeneratorAsync(config, surface);
}
return new RoughGenerator(config, surface);
}
};