代码拉取完成,页面将自动刷新
// 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);
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。