/** * 可视化共享基类:抽 canvas / 事件 / 多边形 contains / 资源释放 */ /** * 可视化共享基类 */ import type { Point } from "./typings"; export declare abstract class VisualizerBase { protected canvas: HTMLCanvasElement; protected ctx: CanvasRenderingContext2D; protected container: HTMLElement; protected image: HTMLImageElement | HTMLCanvasElement | null; protected isReady: boolean; constructor(container: HTMLElement, width?: number, height?: number); /** 加载图像 */ loadImage(image: string | HTMLImageElement | HTMLCanvasElement): Promise; /** 自适应容器尺寸(保持图像纵横比) */ protected fitToContainer(): void; /** 清除画面 */ protected clearCanvas(): void; /** 绘制底图 */ protected drawImage(): void; /** 缩放多边形点到当前画布坐标 */ protected scale(box: Point[]): Point[]; /** 多边形包含点 (ray casting) */ protected pointInPolygon(x: number, y: number, poly: Point[]): boolean; /** 描边多边形 */ protected strokePoly(box: Point[], color: string, lineWidth: number): void; /** 销毁 */ dispose(): void; }