UNPKG

q-floodfill

Version:

Optimized, non-recursive flood fill using a scan line search

28 lines 923 B
import { isSameColor, setColorAtPixel, getColorAtPixel, colorToRGBA } from './util/colorUtils'; export default class FloodFill { imageData: ImageData; isSameColor: typeof isSameColor; setColorAtPixel: typeof setColorAtPixel; getColorAtPixel: typeof getColorAtPixel; colorToRGBA: typeof colorToRGBA; collectModifiedPixels: boolean; modifiedPixelsCount: number; modifiedPixels: Set<string>; private _tolerance; private _queue; private _replacedColor; private _newColor; constructor(imageData: ImageData); /** * color should be in CSS format - rgba, rgb, or HEX */ fill(color: string, x: number, y: number, tolerance: number): void; private addToQueue; private popFromQueue; private isValidTarget; private fillLineAt; private fillQueue; private setPixelColor; private getPixelNeighbour; } //# sourceMappingURL=FloodFill.d.ts.map