// Generated by dts-bundle-generator v9.5.1 interface Point { x: number; y: number; } interface Rectangle { x: number; y: number; width: number; height: number; } interface Dimensions { width: number; height: number; } interface Scale { x: number; y?: number; } interface TextStyle { font: string; textAlign?: CanvasTextAlign; textBaseline?: CanvasTextBaseline; color?: Color; direction?: CanvasDirection; letterSpacing?: string; fontKerning?: CanvasFontKerning; fontStretch?: CanvasFontStretch; fontVariantCaps?: CanvasFontVariantCaps; wordSpacing?: string; } interface Dash { pattern?: number[]; offset?: number; } interface LineStyle { width: number; cap?: CanvasLineCap; dash?: Dash; join?: CanvasLineJoin; } interface Shadow { color?: string; blur?: number; offsetX?: number; offsetY?: number; } type DrawingType = "fill" | "stroke"; interface ColorStop { color: string; offset: number; } type Color = string | CanvasGradient | CanvasPattern; type Repetition = "repeat" | "repeat-x" | "repeat-y" | "no-repeat"; interface Line { type: "line"; from: Point; to: Point; drawn: boolean; } interface QuadraticCurve { type: "quadratic"; from: Point; to: Point; cp1: Point; } interface BezierCurve { type: "bezier"; from: Point; to: Point; cp1: Point; cp2: Point; } type CurveType = "quadratic" | "bezier"; type SegmentType = "line" | CurveType; declare class Segment { type: SegmentType; from: Point; to: Point; cp1?: Point; cp2?: Point; drawn: boolean; constructor(type: SegmentType, from: Point, to: Point, cp1?: Point, cp2?: Point, drawn?: boolean); static FromObject(segment: Line | QuadraticCurve | BezierCurve): Segment; toString(): string; } declare class Path { #private; start: Point; end: Point; closed: boolean; constructor(startPosition: Point); /** * Creates a new Path from a list of segments. */ static FromSegments(closed?: boolean, ...segments: Segment[]): Path; /** * Moves the cursor to the given position. * @param coordinates The coordinates to move to. */ moveTo(coordinates: Point): this; /** * Draws a line from the current position to the given position. * @param coordinates The coordinates to draw to. */ lineTo(coordinates: Point): this; /** * Draws a quadratic curve from the current position to the given position. * @param coordinates The coordinates to draw to. * @param cp The control point. */ quadraticTo(coordinates: Point, cp: Point): this; /** * Draws a bezier curve from the current position to the given position. * @param coordinates The coordinates to draw to. * @param cp1 The first control point. * @param cp2 The second control point. */ bezierTo(coordinates: Point, cp1: Point, cp2: Point): this; /** * Makes the path closed */ close(): this; /** * Makes the path open */ open(): this; /** * Constructs the path on the given canvas context, but does not draw it yet. * @param ctx The canvas context to construct the path on */ construct(ctx: CanvasRenderingContext2D): void; /** * Returns the number of segments in the path. */ get length(): number; /** * Returns a copy of the segments array in the path. */ get segments(): Segment[]; /** * Removes all segments from the path and resets the cursor to the start position. */ clear(): this; /** * Creates a deep clone of the path. */ clone(): Path; /** * Returns a string representation of the path. */ toString(): string; /** * Removes the last segment from the path and returns it. If the path is empty, undefined is returned and the path is not modified. */ pop(): Segment | undefined; /** * Appends new segments to the end of the path and returns the new length of the path. * @param items — New segments to add to the path. */ push(...items: Segment[]): number; /** * Returns a new path that is the result of concatenating the current path with the given segments or paths. * @param items — Segments or paths to concatenate to the current path. * @returns A new path that is the result of concatenating the current path with the given segments or paths. */ concat(...items: Segment[] | Path[]): Path; /** * Reverses the segments in the path in place. This method mutates the path and returns a reference to the same path. */ reverse(): this; /** * Removes the first segment from the path and returns it. If the path is empty, undefined is returned and the path is not modified. */ shift(): Segment | undefined; /** * Appends new segments to the beginning of the path and returns the new length of the path. * @param items — New segments to add to the beginning of the path. * @returns The new length of the path. */ unshift(...items: Segment[]): number; /** * Returns a shallow copy of a portion of the path into a new array object. For both start and end, a negative index can be used to indicate an offset from the end of the path. For example, -2 refers to the second to last segment of the path. * @param start — The beginning of the specified portion of the original path. If start is undefined, then the slice begins at index 0. * @param end — The end of the specified portion of the original path. If end is undefined, then the slice extends to the end of the path. * @returns A new array containing the segments in the specified portion of the original path. */ slice(start?: number, end?: number): Segment[]; /** * Sorts the path segments in place. This method mutates the path and returns a reference to the same path. * @param compareFn — Function used to determine the order of the segments. It is expected to return a negative value if the first argument is less than the second argument, zero if they're equal, and a positive value otherwise. If omitted, the elements are sorted in ascending, UTF-16 code unit order. */ sort(compareFn?: ((a: Segment, b: Segment) => number) | undefined): this; /** * Removes segments from path and, if necessary, inserts new segments in their place, returning the deleted segments. * @param start The zero-based location in the path from which to start removing segments. * @param deleteCount The number of segments to remove. * @returns An array containing the segments that were deleted. */ splice(start: number, deleteCount: number): Segment[]; /** * Removes segments from path and, if necessary, inserts new segments in their place, returning the deleted segments. * @param start The zero-based location in the path from which to start removing segments. * @param deleteCount The number of segments to remove. * @param items Segments to insert into the path in place of the deleted segments. * @returns An array containing the segments that were deleted. */ splice(start: number, deleteCount: number, ...items: Segment[]): Segment[]; /** * Returns the index of the first occurrence of a segment in the path, or -1 if it is not present. * @param searchElement — The segment to locate in the path. * @param fromIndex — The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. */ indexOf(searchElement: Segment, fromIndex?: number): number; /** * Returns the index of the last occurrence of a segment in the path, or -1 if it is not present. * @param searchElement — The segment to locate in the path. * @param fromIndex — The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the path's segment array. */ lastIndexOf(searchElement: Segment, fromIndex?: number): number; /** * Determines whether all the segments in the path pass the test implemented by the provided function. * @param predicate A function that accepts up to three arguments. The every method calls the predicate function for each segment in the path until the predicate returns a value which is coercible to the Boolean value false, or until the end of the path. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ every(predicate: (value: Segment, index: number, array: Segment[]) => unknown, thisArg?: any): boolean; /** * Determines whether the specified callback function returns true for any segment of the path. * @param predicate A function that accepts up to three arguments. The some method calls the predicate function for each segment in the path until the predicate returns a value which is coercible to the Boolean value true, or until the end of the path. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ some(predicate: (value: Segment, index: number, array: Segment[]) => unknown, thisArg?: any): boolean; /** * Performs the specified action for each segment in the path. * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each segment in the path. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: Segment, index: number, array: Segment[]) => void, thisArg?: any): this; /** * Calls a defined callback function on each segment of the path, and returns an array that contains the results. * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each segment in the path. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: Segment, index: number, array: Segment[]) => U, thisArg?: any): U[]; /** * Returns the segments of the path that meet the condition specified in a callback function. * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each segment in the path. * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. */ filter(predicate: (value: Segment, index: number, array: Segment[]) => unknown, thisArg?: unknown): Segment[]; /** * Calls the specified callback function for all segments in the path. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each segment in the path. */ reduce(callbackfn: (previousValue: Segment, currentValue: Segment, currentIndex: number, array: Segment[]) => Segment): Segment; /** * Determines whether the path includes a certain segment, returning true or false as appropriate. * @param searchElement The segment to search for. * @param fromIndex The position in this path at which to begin searching for searchElement. */ includes(searchElement: Segment, fromIndex?: number): boolean; /** * Returns the segment located at the specified index. * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. */ at(index: number): Segment | undefined; /** * Returns the value of the first segment in the path where predicate is true, and undefined otherwise. * @param predicate find calls predicate once for each segment of the path, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined. * @param thisArg If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: Segment, index: number, obj: Segment[]) => unknown, thisArg?: any): Segment | undefined; /** * Returns the index of the first segment in the path where predicate is true, and -1 otherwise. * @param predicate find calls predicate once for each segment of the path, in ascending order, until it finds one where predicate returns true. If such a segment is found, findIndex immediately returns that segment index. Otherwise, findIndex returns -1. * @param thisArg If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: Segment, index: number, obj: Segment[]) => unknown, thisArg?: any): number; /** * Returns the value of the last segment in the path where predicate is true, and undefined otherwise. * @param predicate findLast calls predicate once for each segment of the path, in descending order, until it finds one where predicate returns true. If such a segment is found, findLast immediately returns that segment value. Otherwise, findLast returns undefined. * @param thisArg If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead. */ findLast(predicate: (value: Segment, index: number, array: Segment[]) => unknown, thisArg?: any): Segment | undefined; /** * Returns the index of the last segment in the path where predicate is true, and -1 otherwise. * @param predicate findLastIndex calls predicate once for each segment of the path, in descending order, until it finds one where predicate returns true. If such a segment is found, findLastIndex immediately returns that segment index. Otherwise, findLastIndex returns -1. * @param thisArg If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead. */ findLastIndex(predicate: (value: Segment, index: number, array: Segment[]) => unknown, thisArg?: any): number; /** * Returns an iterable of key, value pairs for every segment in the path */ entries(): IterableIterator<[ number, Segment ]>; /** * Returns an iterable of keys in the path */ keys(): IterableIterator; /** * Returns an iterable of values in the path */ values(): IterableIterator; /** * Returns a copy of the path with its elements reversed. */ toReversed(): Path; /** * Returns a sorted copy of the path. * @param compareFn Function used to determine the order of the segments. It is expected to return a negative value if the first argument is less than the second argument, zero if they're equal, and a positive value otherwise. If omitted, the segments are sorted in ascending, UTF-16 code unit order. */ toSorted(compareFn?: ((a: Segment, b: Segment) => number) | undefined): Path; /** * Copies a path and removes segments while returning the remaining segments. * @param start The zero-based location in the path from which to start removing segments. * @param deleteCount The number of segments to remove. * @returns A copy of the original path with the remaining segments. */ toSpliced(start: number, deleteCount?: number): Path; /** * Copies a path and removes segments and, if necessary, inserts new segments in their place. Returns the copied path. * @param start The zero-based location in the path from which to start removing segments. * @param deleteCount The number of segments to remove. * @param items Elements to insert into the copied path in place of the deleted segments. * @returns The copied path. */ toSpliced(start: number, deleteCount: number, ...items: Segment[]): Path; /** * Copies the path, then overwrites the value at the provided index with the given value. If the index is negative, then it replaces from the end of the path. * @param index The index of the value to overwrite. If the index is negative, then it replaces from the end of the path. * @param value The value to write into the copied path. * @returns The copied path with the updated value. */ with(index: number, value: Segment): Path; } interface MgineOptions { pixelArt?: boolean; fillAvailableSpace?: boolean; width?: number; height?: number; transparentBackground?: boolean; } declare class Mgine { #private; static DefaultFontFamily: string; constructor(id: string, options?: MgineOptions); static Init(id: string, options?: MgineOptions): Mgine; static PreloadImage(src: string): Promise; static PreloadImages(sources: string[]): Promise; get canvas(): HTMLCanvasElement; get ctx(): CanvasRenderingContext2D; get options(): MgineOptions; setLineStyle(lineStyle?: LineStyle): void; setTextStyle(textStyle: TextStyle): void; clear(keepTransform?: boolean): void; reset(): void; clearRect(rect: Rectangle): void; save(): void; restore(): void; resetShadow(): void; setShadow(shadow?: Shadow): void; linearGradient(from: Point, to: Point, colorStops: ColorStop[]): CanvasGradient; radialGradient(from: Point, fromRadius: number, to: Point, toRadius: number, colorStops: ColorStop[]): CanvasGradient; conicGradient(startAngle: number, center: Point, colorStops: ColorStop[]): CanvasGradient; pattern(image: HTMLImageElement, repetition?: Repetition): CanvasPattern | null; fillRect(rect: Rectangle, fillStyle: Color): void; strokeRect(rect: Rectangle, strokeStyle: Color, lineStyle?: LineStyle): void; rect(rect: Rectangle, color: Color, type?: DrawingType, lineStyle?: LineStyle): void; polygon(points: Point[], color: Color, type?: DrawingType, lineStyle?: LineStyle): void; fillCircle(center: Point, radius: number, fillStyle: Color): void; strokeCircle(center: Point, radius: number, strokeStyle: Color, lineStyle?: LineStyle): void; circle(center: Point, radius: number, color: Color, drawingType?: DrawingType, lineStyle?: LineStyle): void; partialEllipse(center: Point, radius: Point, rotation: number | undefined, startAngle: number | undefined, endAngle: number | undefined, counterClockwise: boolean | undefined, color: Color, type?: DrawingType, lineStyle?: LineStyle): void; ellipse(xy1: Point, xy2: Point, color: Color, type?: DrawingType, lineStyle?: LineStyle): void; ellipseFromCenter(center: Point, radius: Point, color: Color, type?: DrawingType, lineStyle?: LineStyle): void; pointsToPath(points: Point[], closed?: boolean): Path; line(from: Point, to: Point, strokeStyle: Color, lineStyle?: LineStyle): void; bezierCurve(from: Point, control1: Point, control2: Point, to: Point, strokeStyle: Color, lineStyle?: LineStyle): void; quadraticCurve(from: Point, control: Point, to: Point, strokeStyle: Color, lineStyle?: LineStyle): void; curve(from: Point, to: Point, strokeStyle: Color, type: CurveType, lineStyle: LineStyle | undefined, control1: Point, control2?: Point): void; linearPath(points: Point[], strokeStyle: Color, lineStyle?: LineStyle): void; createPath(startingPoint: Point): Path; fillPath(path: Path, fillStyle: Color): void; strokePath(path: Path, strokeStyle: Color, lineStyle?: LineStyle): void; path(path: Path, color: Color, type?: DrawingType, lineStyle?: LineStyle): void; arc(center: Point, radius: number, startAngle: number, endAngle: number, counterClockwise: boolean | undefined, style: Color, type?: DrawingType, lineStyle?: LineStyle): void; progressBar(rect: Rectangle, progress: number, showText?: boolean, backgroundColor?: Color, progressColor?: Color, textColor?: Color, borderColor?: Color, borderWidth?: number): void; circularProgressBar(center: Point, radius: number, progress: number, showText?: boolean, thickness?: number, backgroundColor?: Color, progressColor?: Color, textColor?: Color, maxFontSize?: number, lineCap?: CanvasLineCap, startAngle?: number): void; drawImage(img: HTMLImageElement, coordinates: Point, scale?: Scale): void; drawImage(img: HTMLImageElement, coordinates: Point, size?: Dimensions): void; fillText(text: string, coordinates: Point, style: TextStyle, maxWidth?: number): void; strokeText(text: string, coordinates: Point, style: TextStyle, lineStyle?: LineStyle, maxWidth?: number): void; measureText(text: string, style: TextStyle): TextMetrics; } export declare class MgineTesting { #private; readonly mgine: Mgine; get canvas(): HTMLCanvasElement; get ctx(): CanvasRenderingContext2D; constructor(mgine: Mgine); clear(): void; } export {};