image-in-browser
Version:
Package for encoding / decoding images, transforming images, applying filters, drawing primitives on images on the client side (no need for server Node.js)
153 lines (152 loc) • 5.64 kB
TypeScript
/** @format */
/**
* Class representing WebP filters.
*/
export declare class WebPFilters {
/**
* Predicts a line of pixels.
* @param {InputBuffer<Uint8Array>} src - Source input buffer.
* @param {InputBuffer<Uint8Array>} pred - Prediction input buffer.
* @param {InputBuffer<Uint8Array>} dst - Destination input buffer.
* @param {number} length - Length of the line.
* @param {boolean} inverse - Whether to apply inverse prediction.
*/
private static predictLine;
/**
* Applies horizontal filter to the image data.
* @param {Uint8Array} src - Source image data.
* @param {number} width - Width of the image.
* @param {number} _height - Height of the image.
* @param {number} stride - Stride of the image.
* @param {number} row - Starting row.
* @param {number} numRows - Number of rows to process.
* @param {boolean} inverse - Whether to apply inverse filter.
* @param {Uint8Array} _out - Output image data.
*/
private static doHorizontalFilter;
/**
* Applies vertical filter to the image data.
* @param {Uint8Array} src - Source image data.
* @param {number} width - Width of the image.
* @param {number} _height - Height of the image.
* @param {number} stride - Stride of the image.
* @param {number} row - Starting row.
* @param {number} numRows - Number of rows to process.
* @param {boolean} inverse - Whether to apply inverse filter.
* @param {Uint8Array} out - Output image data.
*/
private static doVerticalFilter;
/**
* Predicts a gradient value.
* @param {number} a - First value.
* @param {number} b - Second value.
* @param {number} c - Third value.
* @returns {number} The predicted gradient value.
*/
private static gradientPredictor;
/**
* Applies gradient filter to the image data.
* @param {Uint8Array} src - Source image data.
* @param {number} width - Width of the image.
* @param {number} _height - Height of the image.
* @param {number} stride - Stride of the image.
* @param {number} row - Starting row.
* @param {number} numRows - Number of rows to process.
* @param {boolean} inverse - Whether to apply inverse filter.
* @param {Uint8Array} out - Output image data.
*/
private static doGradientFilter;
/**
* Applies horizontal filter to the image data.
* @param {Uint8Array} data - Source image data.
* @param {number} width - Width of the image.
* @param {number} height - Height of the image.
* @param {number} stride - Stride of the image.
* @param {Uint8Array} filteredData - Output filtered image data.
*/
private static horizontalFilter;
/**
* Applies horizontal unfilter to the image data.
* @param {number} width - Width of the image.
* @param {number} height - Height of the image.
* @param {number} stride - Stride of the image.
* @param {number} row - Starting row.
* @param {number} numRows - Number of rows to process.
* @param {Uint8Array} data - Image data to be unfiltered.
*/
private static horizontalUnfilter;
/**
* Applies vertical filter to the image data.
* @param {Uint8Array} data - Source image data.
* @param {number} width - Width of the image.
* @param {number} height - Height of the image.
* @param {number} stride - Stride of the image.
* @param {Uint8Array} filteredData - Output filtered image data.
*/
private static verticalFilter;
/**
* Applies vertical unfilter to the image data.
* @param {number} width - Width of the image.
* @param {number} height - Height of the image.
* @param {number} stride - Stride of the image.
* @param {number} row - Starting row.
* @param {number} numRows - Number of rows to process.
* @param {Uint8Array} data - Image data to be unfiltered.
*/
private static verticalUnfilter;
/**
* Applies gradient filter to the image data.
* @param {Uint8Array} data - Source image data.
* @param {number} width - Width of the image.
* @param {number} height - Height of the image.
* @param {number} stride - Stride of the image.
* @param {Uint8Array} filteredData - Output filtered image data.
*/
private static gradientFilter;
/**
* Applies gradient unfilter to the image data.
* @param {number} width - Width of the image.
* @param {number} height - Height of the image.
* @param {number} stride - Stride of the image.
* @param {number} row - Starting row.
* @param {number} numRows - Number of rows to process.
* @param {Uint8Array} data - Image data to be unfiltered.
*/
private static gradientUnfilter;
/**
* No filter.
*/
static readonly filterNone = 0;
/**
* Horizontal filter.
*/
static readonly filterHorizontal = 1;
/**
* Vertical filter.
*/
static readonly filterVertical = 2;
/**
* Gradient filter.
*/
static readonly fitlerGradient = 3;
/**
* End marker for filters.
*/
static readonly fitlerLast: number;
/**
* Best filter.
*/
static readonly fitlerBest = 5;
/**
* Fast filter.
*/
static readonly filterFast = 6;
/**
* Array of filter functions.
*/
static readonly filters: (typeof WebPFilters.horizontalFilter | undefined)[];
/**
* Array of unfilter functions.
*/
static readonly unfilters: (typeof WebPFilters.horizontalUnfilter | undefined)[];
}