Skip to main content
Version: 1.x

@microsoft/fast-colors > Histogram > (constructor)

Histogram.(constructor)

Constructs a new instance of the Histogram class

Signature:
constructor(source: PixelBlob, significantBits?: number, pixelSkipping?: number, isHistogramPixelValid?: ((pixel: number[]) => boolean) | null);

Parameters

ParameterTypeDescription
sourcePixelBlobthe source pixel data.
significantBitsnumberThe memory needed for the histogram increases dramatically if significantBits is increased. It needs a buffer which is 4*2^(3*significantBits) in size. EG: for 5 significant bits the histogram is 128K while for 8 it is 64 megs.
pixelSkippingnumberCPU time increases linearly as pixelSkipping is reduced.
isHistogramPixelValid((pixel: number[]) => boolean) | nullisHistogramPixelValid is an optional predicate which can screen out unwanted pixels from the source data. EG: ignoring transparent pixels.