import { ImageCropzoneRect } from "../../../models"; import Graphics from "./graphics"; type AngleType = number; interface IThemeConfig { "common.bi.image"?: string; "common.bisize.width"?: string; "common.bisize.height"?: string; "common.backgroundImage"?: string; "common.backgroundColor"?: string; "common.border"?: string; "header.backgroundImage"?: string; "header.backgroundColor"?: string; "header.border"?: string; "loadButton.backgroundColor"?: string; "loadButton.border"?: string; "loadButton.color"?: string; "loadButton.fontFamily"?: string; "loadButton.fontSize"?: string; "downloadButton.backgroundColor"?: string; "downloadButton.border"?: string; "downloadButton.color"?: string; "downloadButton.fontFamily"?: string; "downloadButton.fontSize"?: string; "menu.normalIcon.path"?: string; "menu.normalIcon.name"?: string; "menu.activeIcon.path"?: string; "menu.activeIcon.name"?: string; "menu.iconSize.width"?: string; "menu.iconSize.height"?: string; "submenu.backgroundColor"?: string; "submenu.partition.color"?: string; "submenu.normalIcon.path"?: string; "submenu.normalIcon.name"?: string; "submenu.activeIcon.path"?: string; "submenu.activeIcon.name"?: string; "submenu.iconSize.width"?: string; "submenu.iconSize.height"?: string; "submenu.normalLabel.color"?: string; "submenu.normalLabel.fontWeight"?: string; "submenu.activeLabel.color"?: string; "submenu.activeLabel.fontWeight"?: string; "checkbox.border"?: string; "checkbox.backgroundColor"?: string; "range.pointer.color"?: string; "range.bar.color"?: string; "range.subbar.color"?: string; "range.value.color"?: string; "range.value.fontWeight"?: string; "range.value.fontSize"?: string; "range.value.border"?: string; "range.value.backgroundColor"?: string; "range.title.color"?: string; "range.title.fontWeight"?: string; "colorpicker.button.border"?: string; "colorpicker.title.color"?: string; } interface IIconInfo { [propName: string]: string; } interface IIconOptions { fill?: string; left?: number; top?: number; } interface IShapeOptions { fill?: string; stroke?: string; strokeWidth?: number; width?: number; height?: number; rx?: number; ry?: number; left?: number; top?: number; isRegular?: boolean; } interface IGenerateTextOptions { styles?: ITextStyleConfig; position?: { x: number; y: number; }; } interface ITextStyleConfig { fill?: string; fontFamily?: string; fontSize?: number; fontStyle?: string; fontWeight?: string; textAlign?: string; textDecoration?: string; } interface ICanvasSize { width: number; height: number; } interface IBrushOptions { width: number; color: string; } interface IPositionConfig { x: number; y: number; originX: string; originY: string; } interface IToDataURLOptions { format?: string; quality?: number; multiplier?: number; left?: number; top?: number; width?: number; height?: number; } interface IGraphicObjectProps { id?: number; type?: string; text?: string; left?: string | number; top?: string | number; width?: string | number; height?: string | number; fill?: string; stroke?: string; strokeWidth?: string | number; fontFamily?: string; fontSize?: number; fontStyle?: string; fontWeight?: string; textAlign?: string; textDecoration?: string; opacity?: number; [propName: string]: number | string | boolean | undefined; } interface IIncludeUIOptions { loadImage?: { path: string; name: string; }; theme?: IThemeConfig; menu?: string[]; initMenu?: string; uiSize?: { width: string; height: string; }; menuBarPosition?: string; usageStatistics?: boolean; } interface ISelectionStyleConfig { cornerStyle?: string; cornerSize?: number; cornerColor?: string; cornerStrokeColor?: string; transparentCorners?: boolean; lineWidth?: number; borderColor?: string; rotatingPointOffset?: number; } interface IObjectProps { fill: string; height: number; id: number; left: number; opacity: number; stroke: string | null; strokeWidth: number | null; top: number; type: string; width: number; } interface ITextObjectProps extends IObjectProps { fontFamily: string; fontSize: string; fontStyle: string; text: string; textAlign: string; textDecoration: string; } export interface IFilterResolveObject { type: string; action: string; } export interface ICropResolveObject { oldWidth: number; oldHeight: number; newWidth: number; newHeight: number; } export interface IFlipXYResolveObject { flipX: boolean; flipY: boolean; angle: AngleType; } interface IOptions { includeUI?: IIncludeUIOptions; cssMaxWidth?: number; cssMaxHeight?: number; usageStatistics?: boolean; selectionStyle?: ISelectionStyleConfig; } interface IUIDimension { height?: string; width?: string; } interface IImageDimension { oldHeight?: number; oldWidth?: number; newHeight?: number; newWidth?: number; } interface IEditorSize { uiSize?: IUIDimension; imageSize?: IImageDimension; } interface UI { resizeEditor(dimension: IEditorSize): Promise; } export default interface IImageEditor { _graphics?: Graphics; constructor?(wrapper: string | Element, options: IOptions): any; ui?: UI; addIcon?(type: string, options?: IIconOptions): Promise; addImageObject?(imgUrl: string): Promise; addShape?(type: string, options?: IShapeOptions): Promise; addText?(text: string, options?: IGenerateTextOptions): Promise; applyFilter?(type: string, options?: { maskObjId: number; }, isSilent?: boolean): Promise; changeCursor?(cursorType: string): void; changeIconColor?(id: number, color: string): Promise; changeSelectableAll?(selectable: boolean): void; changeShape?(id: number, options?: IShapeOptions, isSilent?: boolean): Promise; changeText?(id: number, text?: string): Promise; changeTextStyle?(id: number, styleObj: ITextStyleConfig, isSilent?: boolean): Promise; clearObjects?(): Promise; clearRedoStack?(): void; clearUndoStack?(): void; crop?(rect: ImageCropzoneRect): Promise; deactivateAll?(): void; destroy?(): void; discardSelection?(): void; flipX?(): Promise; flipY?(): Promise; getCanvasSize?(): ICanvasSize; getCropzoneRect?(): ImageCropzoneRect; isValidCropzoneRect?(): boolean; getDrawingMode?(): string; getImageName?(): string; getObjectPosition?(id: number, originX: string, originY: string): ICanvasSize; getObjectProperties?(id: number, keys: string | string[] | IGraphicObjectProps): IGraphicObjectProps; hasFilter?(type: string): boolean; isEmptyRedoStack?(): boolean; isEmptyUndoStack?(): boolean; loadImageFromFile?(imgFile: File, imageName?: string): Promise; loadImageFromURL?(url: string, imageName?: string): Promise; redo?(): Promise; registerIcons?(infos: IIconInfo): void; removeActiveObject?(): void; removeFilter?(type?: string): Promise; removeObject?(id: number): Promise; resetFlip?(): Promise; resizeCanvasDimension?(dimension: ICanvasSize): Promise; rotate?(angle: AngleType, isSilent?: boolean): Promise; setAngle?(angle: AngleType, isSilent?: boolean): Promise; setBrush?(option: IBrushOptions): void; setCropzoneRect?(mode?: number): void; restoreCropzoneRect?(presetRatio: number, cropRect: ImageCropzoneRect): void; setDrawingShape?(type: string, options?: IShapeOptions): void; setObjectPosition?(id: number, posInfo?: IPositionConfig): Promise; setObjectProperties?(id: number, keyValue?: IGraphicObjectProps): Promise; setObjectPropertiesQuietly?(id: number, keyValue?: IGraphicObjectProps): Promise; startDrawingMode?(mode: string, option?: { width?: number; color?: string; }): Promise; stopDrawingMode?(): void; toDataURL?(options?: IToDataURLOptions): string; undo?(): Promise; on?(eventName: string, handler: (...args: any[]) => void): void; } export {};