source: imaps-frontend/node_modules/konva/lib/Context.d.ts

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 4.8 KB
Line 
1import { Canvas } from './Canvas.js';
2import { Shape } from './Shape.js';
3import { IRect } from './types.js';
4import type { Node } from './Node.js';
5declare var CONTEXT_PROPERTIES: readonly ["fillStyle", "strokeStyle", "shadowColor", "shadowBlur", "shadowOffsetX", "shadowOffsetY", "letterSpacing", "lineCap", "lineDashOffset", "lineJoin", "lineWidth", "miterLimit", "direction", "font", "textAlign", "textBaseline", "globalAlpha", "globalCompositeOperation", "imageSmoothingEnabled"];
6interface ExtendedCanvasRenderingContext2D extends CanvasRenderingContext2D {
7 letterSpacing: string;
8}
9export declare class Context {
10 canvas: Canvas;
11 _context: CanvasRenderingContext2D;
12 traceArr: Array<String>;
13 constructor(canvas: Canvas);
14 fillShape(shape: Shape): void;
15 _fill(shape: Shape): void;
16 strokeShape(shape: Shape): void;
17 _stroke(shape: Shape): void;
18 fillStrokeShape(shape: Shape): void;
19 getTrace(relaxed?: boolean, rounded?: boolean): string;
20 clearTrace(): void;
21 _trace(str: any): void;
22 reset(): void;
23 getCanvas(): Canvas;
24 clear(bounds?: IRect): void;
25 _applyLineCap(shape: Shape): void;
26 _applyOpacity(shape: Node): void;
27 _applyLineJoin(shape: Shape): void;
28 setAttr(attr: string, val: any): void;
29 arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterClockwise?: boolean): void;
30 arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;
31 beginPath(): void;
32 bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;
33 clearRect(x: number, y: number, width: number, height: number): void;
34 clip(fillRule?: CanvasFillRule): void;
35 clip(path: Path2D, fillRule?: CanvasFillRule): void;
36 closePath(): void;
37 createImageData(width: any, height: any): ImageData | undefined;
38 createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient;
39 createPattern(image: CanvasImageSource, repetition: string | null): CanvasPattern | null;
40 createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient;
41 drawImage(image: CanvasImageSource, sx: number, sy: number, sWidth?: number, sHeight?: number, dx?: number, dy?: number, dWidth?: number, dHeight?: number): void;
42 ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void;
43 isPointInPath(x: number, y: number, path?: Path2D, fillRule?: CanvasFillRule): boolean;
44 fill(fillRule?: CanvasFillRule): void;
45 fill(path: Path2D, fillRule?: CanvasFillRule): void;
46 fillRect(x: number, y: number, width: number, height: number): void;
47 strokeRect(x: number, y: number, width: number, height: number): void;
48 fillText(text: string, x: number, y: number, maxWidth?: number): void;
49 measureText(text: string): TextMetrics;
50 getImageData(sx: number, sy: number, sw: number, sh: number): ImageData;
51 lineTo(x: number, y: number): void;
52 moveTo(x: number, y: number): void;
53 rect(x: number, y: number, width: number, height: number): void;
54 roundRect(x: number, y: number, width: number, height: number, radii: number | DOMPointInit | (number | DOMPointInit)[]): void;
55 putImageData(imageData: ImageData, dx: number, dy: number): void;
56 quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;
57 restore(): void;
58 rotate(angle: number): void;
59 save(): void;
60 scale(x: number, y: number): void;
61 setLineDash(segments: number[]): void;
62 getLineDash(): number[];
63 setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void;
64 stroke(path2d?: Path2D): void;
65 strokeText(text: string, x: number, y: number, maxWidth?: number): void;
66 transform(a: number, b: number, c: number, d: number, e: number, f: number): void;
67 translate(x: number, y: number): void;
68 _enableTrace(): void;
69 _applyGlobalCompositeOperation(node: any): void;
70}
71type CanvasContextProps = Pick<ExtendedCanvasRenderingContext2D, (typeof CONTEXT_PROPERTIES)[number]>;
72export interface Context extends CanvasContextProps {
73}
74export declare class SceneContext extends Context {
75 constructor(canvas: Canvas, { willReadFrequently }?: {
76 willReadFrequently?: boolean | undefined;
77 });
78 _fillColor(shape: Shape): void;
79 _fillPattern(shape: Shape): void;
80 _fillLinearGradient(shape: Shape): void;
81 _fillRadialGradient(shape: Shape): void;
82 _fill(shape: any): void;
83 _strokeLinearGradient(shape: any): void;
84 _stroke(shape: any): void;
85 _applyShadow(shape: any): void;
86}
87export declare class HitContext extends Context {
88 constructor(canvas: Canvas);
89 _fill(shape: Shape): void;
90 strokeShape(shape: Shape): void;
91 _stroke(shape: any): void;
92}
93export {};
Note: See TracBrowser for help on using the repository browser.