wuQuant.d.ts
2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/**
* @preserve
* Copyright 2015-2016 Igor Bezkrovnyi
* All rights reserved. (MIT Licensed)
*
* wuQuant.ts - part of Image Quantization Library
*/
import { Palette } from "../../utils/palette";
import { PointContainer } from "../../utils/pointContainer";
import { AbstractDistanceCalculator } from "../../distance/abstractDistanceCalculator";
export declare class WuColorCube {
redMinimum: number;
redMaximum: number;
greenMinimum: number;
greenMaximum: number;
blueMinimum: number;
blueMaximum: number;
volume: number;
alphaMinimum: number;
alphaMaximum: number;
}
export declare class WuQuant {
private static readonly alpha;
private static readonly red;
private static readonly green;
private static readonly blue;
private _reds;
private _greens;
private _blues;
private _alphas;
private _sums;
private _weights;
private _momentsRed;
private _momentsGreen;
private _momentsBlue;
private _momentsAlpha;
private _moments;
private _table;
private _pixels;
private _cubes;
private _colors;
private _significantBitsPerChannel;
private _maxSideIndex;
private _alphaMaxSideIndex;
private _sideSize;
private _alphaSideSize;
private readonly _distance;
constructor(colorDistanceCalculator: AbstractDistanceCalculator, colors?: number, significantBitsPerChannel?: number);
sample(image: PointContainer): void;
quantize(): Palette;
private _preparePalette();
private _addColor(color);
/**
* Converts the histogram to a series of _moments.
*/
private _calculateMoments();
/**
* Computes the volume of the cube in a specific moment.
*/
private static _volumeFloat(cube, moment);
/**
* Computes the volume of the cube in a specific moment.
*/
private static _volume(cube, moment);
/**
* Splits the cube in given position][and color direction.
*/
private static _top(cube, direction, position, moment);
/**
* Splits the cube in a given color direction at its minimum.
*/
private static _bottom(cube, direction, moment);
/**
* Calculates statistical variance for a given cube.
*/
private _calculateVariance(cube);
/**
* Finds the optimal (maximal) position for the cut.
*/
private _maximize(cube, direction, first, last, wholeRed, wholeGreen, wholeBlue, wholeAlpha, wholeWeight);
private _cut(first, second);
private _initialize(colors);
private _setQuality(significantBitsPerChannel?);
}