/// //@ts-ignore import { i18n } from "i18next"; import { ImageFormatCode } from "../../ImageViewer/Models"; import { IImageViewer } from "../../ImageViewer/Models/IImageViewer"; import { Size } from "../../ImageViewer/Models/SelectionBoxTypes"; import { ImageViewerPluginBase, PluginType } from "../../ImageViewer/Core/ImageViewerPluginBase"; export declare function mirrorImage(ctx: CanvasRenderingContext2D, image: HTMLImageElement, x?: number, y?: number, horizontal?: boolean, vertical?: boolean): void; /** * Page tools toolbar button key. **/ export declare type PageToolButtonKey = "rotate-image" | "flip-horizontal" | "flip-vertical" | "crop-image" | "resize-image" | "$split" | "edit-undo" | "edit-redo"; /** * PageToolsPlugin options. **/ export declare type PageToolsPluginOptions = { /** * The position where the "Page tools" button should be inserted. Use `false` or `-1` to skip insertion. Undefined means the position will be determined automatically. **/ buttonPosition?: number | false; /** * The page tools toolbar layout. * @default * Default layout: * ["rotate-image", "flip-horizontal", "flip-vertical", "crop-image", "resize-image"] * @example * ```javascript * * * * ``` **/ toolbarLayout?: PageToolButtonKey[]; }; /** * PageToolsPlugin class. * Adds the "Page tools" button. * @example * ```javascript * * * * ``` * @param {any} options **/ export declare class PageToolsPlugin extends ImageViewerPluginBase { /** * Unique plugin identifier. **/ readonly id: PluginType; /** * Plugin options **/ options: PageToolsPluginOptions; private _totalRotation; /** * PageToolsPlugin constructor. * @param options plugin options */ constructor(options?: PageToolsPluginOptions); /** * Returns true if the image is loaded into the viewer and the image format is supported by the Page Tools plugin. **/ get isReady(): boolean; /** * Viewer instance identifier. * @ignore exclude from docs. **/ get instanceId(): string; /** * @ignore exclude from docs. **/ get maxImageSize(): Size; /** * Natural image size. **/ get naturalSize(): { width: number; height: number; }; /** * Gets second toolbar layout. * @ignore exclude from documentation. **/ get toolbarLayout(): PageToolButtonKey[]; get viewer(): IImageViewer; initialize(viewer: any): void; dispose(): void; get in17n(): i18n; /** * Gets current rotation in degrees. **/ get totalRotation(): number; /** * Rotate image. **/ rotate(rotation: number): Promise; /** * Checks if the image format specified by the imageFormat parameter is supported. * @param imageFormat **/ isImageFormatSupported(imageFormat: ImageFormatCode | string, allowUnknown?: boolean): boolean; /** * Crop image. * @param x * @param y * @param width * @param height */ crop(x: number, y: number, width: number, height: number): Promise; /** * Resize image. * @param width * @param height * @param keepAspectRatio */ resize(width: number, height: number, keepAspectRatio?: boolean): Promise; /** * Flip image. **/ flip(horizontal?: boolean, vertical?: boolean): Promise; /** * Flip image horizontally. **/ flipHorizontal(): Promise; /** * Flip image vertically. **/ flipVertical(): Promise; private _onBeforeOpen; /** * Rotate image data action. **/ private _rotateImageData; private _imageSizeAfterRotation; private _ensureOptions; }