/** * Utility to downscale large images safely based on browser/canvas capabilities. * * @private */ export declare class _PdfImageResizer { minimumImageDimension: number; maximumImageDimension: number; error: number; goodSquareLength: number; isImageDecoderSupported: boolean; /** * Original image data object . * * @private */ private _imgData; /** * Flag indicating this image is used as a mask. * * @private */ private _isMask; /** * Indicates whether a maximum canvas area was already set/probed. * * @private */ private _hasMaxArea; constructor(); constructor(imgData: any, isMask: boolean); readonly canUseImageDecoder: any; /** * Returns whether the image should be resized based on current constraints. * * @private * @param {number} width Image width. * @param {number} height Image height. * @returns {boolean} `true` if a resize is required otherwise, `false`. */ _needsToBeResized(width: number, height: number): boolean; /** * Computes the JPX reduce power based on constraints and JPX decoder limits. * * @private * @param {number} width Image width. * @param {number} height Image height. * @param {number} componentsCount Number of components. * @returns {number} Reduce power `n` such that decoder can use 2^n reduction. */ _getReducePowerForJPX(width: number, height: number, componentsCount: number): number; /** * Probed maximum acceptable dimension for either width or height. * * @private * @returns {number} Maximum acceptable single dimension. */ readonly _maximumDim: number; /** * Probed maximum acceptable area derived from current constraints. * * @private * @returns {number} Maximum acceptable area in pixels. */ /** * Marks that a maximum area constraint has been established. * * @private * @param {number} area Area value used to mark presence of max area. * @returns {void} nothing. */ _maximumArea: number; /** * Applies configuration options, like canvas max area and ImageDecoder support flag. * * @private * @param {object} param0 Options object. * @param {number} [param0.canvasMaxAreaInBytes=-1] Max canvas area in bytes. * @param {boolean} [param0.isImageDecoderSupported=false] Feature flag for ImageDecoder. * @returns {any} returns image flag. */ _setOptions({ canvasMaxAreaInBytes, isImageDecoderSupported }: { canvasMaxAreaInBytes?: number; isImageDecoderSupported?: boolean; }): any; /** * Feature test to check if a canvas of is usable for drawing. * * @private * @param {number} width Target width. * @param {number} height Target height. * @returns {boolean} `true` if drawing succeeds; otherwise, `false`. */ _areGoodDims(width: number, height: number): boolean; /** * Binary-search-like probe to find maximum acceptable dimension between start and end. * * @private * @param {number} start Lower bound dimension to test from. * @param {number} end Upper bound dimension to test up to. * @param {number} tolerance Allowed gap to stop probing. * @param {number} defaultHeight If non-zero, height to test with. * @returns {number} Maximum acceptable dimension found. */ _guessMax(start: number, end: number, tolerance: number, defaultHeight: number): number; /** * Helper to build a resized image from external imgData. * * @private * @param {any} imgData Image-like object with width/height/data|bitmap/kind. * @param {boolean} [isMask=false] Whether the image is a mask. * @returns {any} Resulting image data . */ _createImageData(imgData: any, isMask?: boolean): any; /** * Resizes the current instance `_imgData` if needed; returns the updated image data. * * @private * @returns {any} Updated image data possibly with `bitmap` and new dimensions. */ _createImage(): any; /** * Downscales raw image data to fit into maximum buffer constraints and returns data or null. * * @private * @returns {any} Updated `imgData` when final image can be used directly; otherwise `null` to continue. */ _rescaleImageData(): any; /** * Encodes the image as a BMP byte array. * * @private * @returns {Uint8Array} BMP-encoded byte array. * @throws {Error} On invalid format. */ _encodeBMP(): Uint8Array; }