import { Node, NodeConfig } from './Node.js'; import { Context } from './Context.js'; import { GetSet, Vector2d } from './types.js'; import { HitCanvas, SceneCanvas } from './Canvas.js'; export type ShapeConfigHandler = { bivarianceHack(ctx: Context, shape: TTarget): void; }['bivarianceHack']; export type LineJoin = 'round' | 'bevel' | 'miter'; export type LineCap = 'butt' | 'round' | 'square'; export interface ShapeConfig extends NodeConfig { fill?: string | CanvasGradient; fillPatternImage?: HTMLImageElement; fillPatternX?: number; fillPatternY?: number; fillPatternOffset?: Vector2d; fillPatternOffsetX?: number; fillPatternOffsetY?: number; fillPatternScale?: Vector2d; fillPatternScaleX?: number; fillPatternScaleY?: number; fillPatternRotation?: number; fillPatternRepeat?: string; fillLinearGradientStartPoint?: Vector2d; fillLinearGradientStartPointX?: number; fillLinearGradientStartPointY?: number; fillLinearGradientEndPoint?: Vector2d; fillLinearGradientEndPointX?: number; fillLinearGradientEndPointY?: number; fillLinearGradientColorStops?: Array; fillRadialGradientStartPoint?: Vector2d; fillRadialGradientStartPointX?: number; fillRadialGradientStartPointY?: number; fillRadialGradientEndPoint?: Vector2d; fillRadialGradientEndPointX?: number; fillRadialGradientEndPointY?: number; fillRadialGradientStartRadius?: number; fillRadialGradientEndRadius?: number; fillRadialGradientColorStops?: Array; fillEnabled?: boolean; fillPriority?: string; fillRule?: CanvasFillRule; stroke?: string | CanvasGradient; strokeWidth?: number; fillAfterStrokeEnabled?: boolean; hitStrokeWidth?: number | string; strokeScaleEnabled?: boolean; strokeHitEnabled?: boolean; strokeEnabled?: boolean; lineJoin?: LineJoin; lineCap?: LineCap; sceneFunc?: (con: Context, shape: Shape) => void; hitFunc?: (con: Context, shape: Shape) => void; shadowColor?: string; shadowBlur?: number; shadowOffset?: Vector2d; shadowOffsetX?: number; shadowOffsetY?: number; shadowOpacity?: number; shadowEnabled?: boolean; shadowForStrokeEnabled?: boolean; dash?: number[]; dashOffset?: number; dashEnabled?: boolean; perfectDrawEnabled?: boolean; } export interface ShapeGetClientRectConfig { skipTransform?: boolean; skipShadow?: boolean; skipStroke?: boolean; relativeTo?: Node; } export type FillFuncOutput = void | [Path2D | CanvasFillRule] | [Path2D, CanvasFillRule]; export declare const shapes: { [key: string]: Shape; }; export declare class Shape extends Node { _centroid: boolean; colorKey: string; _fillFunc: (ctx: Context) => FillFuncOutput; _strokeFunc: (ctx: Context) => void; _fillFuncHit: (ctx: Context) => void; _strokeFuncHit: (ctx: Context) => void; constructor(config?: Config); getContext(): Context; getCanvas(): SceneCanvas; getSceneFunc(): any; getHitFunc(): any; hasShadow(): any; _hasShadow(): boolean; _getFillPattern(): any; __getFillPattern(): CanvasPattern | null | undefined; _getLinearGradient(): any; __getLinearGradient(): CanvasGradient | undefined; _getRadialGradient(): any; __getRadialGradient(): CanvasGradient | undefined; getShadowRGBA(): any; _getShadowRGBA(): string | undefined; hasFill(): any; hasStroke(): any; hasHitStroke(): any; intersects(point: any): boolean; destroy(): this; _useBufferCanvas(forceFill?: boolean): boolean; setStrokeHitEnabled(val: number): void; getStrokeHitEnabled(): boolean; getSelfRect(): { x: number; y: number; width: number; height: number; }; getClientRect(config?: ShapeGetClientRectConfig): { width: number; height: number; x: number; y: number; }; drawScene(can?: SceneCanvas, top?: Node, bufferCanvas?: SceneCanvas): this; drawHit(can?: HitCanvas, top?: Node, skipDragCheck?: boolean): this; drawHitFromCache(alphaThreshold?: number): this; hasPointerCapture(pointerId: number): boolean; setPointerCapture(pointerId: number): void; releaseCapture(pointerId: number): void; draggable: GetSet; embossBlend: GetSet; dash: GetSet; dashEnabled: GetSet; dashOffset: GetSet; fill: GetSet; fillEnabled: GetSet; fillLinearGradientColorStops: GetSet, this>; fillLinearGradientStartPoint: GetSet; fillLinearGradientStartPointX: GetSet; fillLinearGradientStartPointY: GetSet; fillLinearGradientEndPoint: GetSet; fillLinearGradientEndPointX: GetSet; fillLinearGradientEndPointY: GetSet; fillLinearRadialStartPoint: GetSet; fillLinearRadialStartPointX: GetSet; fillLinearRadialStartPointY: GetSet; fillLinearRadialEndPoint: GetSet; fillLinearRadialEndPointX: GetSet; fillLinearRadialEndPointY: GetSet; fillPatternImage: GetSet; fillRadialGradientStartRadius: GetSet; fillRadialGradientEndRadius: GetSet; fillRadialGradientColorStops: GetSet, this>; fillRadialGradientStartPoint: GetSet; fillRadialGradientStartPointX: GetSet; fillRadialGradientStartPointY: GetSet; fillRadialGradientEndPoint: GetSet; fillRadialGradientEndPointX: GetSet; fillRadialGradientEndPointY: GetSet; fillPatternOffset: GetSet; fillPatternOffsetX: GetSet; fillPatternOffsetY: GetSet; fillPatternRepeat: GetSet; fillPatternRotation: GetSet; fillPatternScale: GetSet; fillPatternScaleX: GetSet; fillPatternScaleY: GetSet; fillPatternX: GetSet; fillPatternY: GetSet; fillPriority: GetSet; hitFunc: GetSet, this>; lineCap: GetSet; lineJoin: GetSet; perfectDrawEnabled: GetSet; sceneFunc: GetSet, this>; shadowColor: GetSet; shadowEnabled: GetSet; shadowForStrokeEnabled: GetSet; shadowOffset: GetSet; shadowOffsetX: GetSet; shadowOffsetY: GetSet; shadowOpacity: GetSet; shadowBlur: GetSet; stroke: GetSet; strokeEnabled: GetSet; fillAfterStrokeEnabled: GetSet; strokeScaleEnabled: GetSet; strokeHitEnabled: GetSet; strokeWidth: GetSet; hitStrokeWidth: GetSet; strokeLinearGradientStartPoint: GetSet; strokeLinearGradientEndPoint: GetSet; strokeLinearGradientColorStops: GetSet, this>; }