1 Star 0 Fork 0

zhujunzhujunzhu/fabric.js

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
index.node.ts 1.27 KB
一键复制 编辑 原始数据 按行查看 历史
// First we set the env variable
import { setEnv } from './src/env';
import { getEnv, getNodeCanvas } from './src/env/node';
setEnv(getEnv());
// After the env is set we can export everything and expose specific node functionality
import type { JpegConfig, PngConfig } from 'canvas';
import {
Canvas as CanvasBase,
StaticCanvas as StaticCanvasBase,
} from './fabric';
import { FabricObject } from './src/shapes/Object/Object';
FabricObject.ownDefaults.objectCaching = false;
export * from './fabric';
export class StaticCanvas extends StaticCanvasBase {
getNodeCanvas() {
return getNodeCanvas(this.getElement());
}
createPNGStream(opts?: PngConfig) {
return this.getNodeCanvas().createPNGStream(opts);
}
createJPEGStream(opts?: JpegConfig) {
return this.getNodeCanvas().createJPEGStream(opts);
}
}
/**
* **NOTICE**:
* {@link Canvas} is designed for interactivity.
* Therefore, using it in node has no benefit.
* Use {@link StaticCanvas} instead.
*/
export class Canvas extends CanvasBase {
getNodeCanvas() {
return getNodeCanvas(this.getElement());
}
createPNGStream(opts?: PngConfig) {
return this.getNodeCanvas().createPNGStream(opts);
}
createJPEGStream(opts?: JpegConfig) {
return this.getNodeCanvas().createJPEGStream(opts);
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhujun12/fabric.js.git
git@gitee.com:zhujun12/fabric.js.git
zhujun12
fabric.js
fabric.js
master

搜索帮助