draw-html-to-canvas
Version:
根据html+css规范绘制 网页到canvas
21 lines (20 loc) • 677 B
TypeScript
import { SupportElementType } from './constants';
import ElementImage from './element-image';
export interface IOption {
debug: boolean;
}
export default class Render {
static fromHTML(html: string, option: IOption): Render;
rawHTML: string;
rootNode: SupportElementType;
elements: SupportElementType[];
constructor(html: string, option?: IOption);
/**
* 参数将直接透传给 ElementImage.prototype.load 方法
* @param canvas
*/
loadSource(canvas?: HTMLCanvasElement): Promise<ElementImage[]>;
layout(context: CanvasRenderingContext2D): void;
draw(context: CanvasRenderingContext2D): void;
}
export { ElementImage };