-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtexen.d.ts
282 lines (282 loc) · 7.2 KB
/
texen.d.ts
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
/// <reference path="typings/lodash/lodash.d.ts" />
/// <reference path="typings/node/node.d.ts" />
declare module tx {
interface IColorStop extends Array<number> {
}
interface IGradient extends Array<IColorStop> {
}
}
declare module tx {
interface IData {
type: string;
source?: string;
min?: number;
max?: number;
}
interface IRender extends IData {
scale: number;
}
interface IFeature extends IData {
}
}
declare module tx {
class Utils {
static forEach: (array: Array<any> | Object, callback: (value: any, key: any) => void, obj?: any) => Array<any>;
static indexOf: (array: Array<any>, value: any) => number;
static remove(old: Array<any>): Array<any>;
}
}
declare module tx {
class Formula {
render: {
[index: string]: IRender;
};
textures: {
[index: string]: IFeature;
};
functions: {
[index: string]: IFeature;
};
gradients: {
[index: string]: IGradient;
};
static fromJson(json: string): Formula;
static basic(): Formula;
constructor(obj: any);
toJson(): string;
isValid(): boolean;
scale(): number;
cloneFeatures(): Formula;
}
}
declare module tx {
class Colors {
static rgbToHex(r: number, g: number, b: number): string;
static hslToRgb(h: number, s: number, l: number): Array<number>;
static rgbToHsl(r: number, g: number, b: number): Array<number>;
static HslToHslInteger(h: number, s: number, l: number): Array<number>;
static HslIntegerToHsl(h: number, s: number, l: number): Array<number>;
static getContrastColor(c: Array<number>): string;
static hexToRgb(h: string): Array<number>;
private static cutHex(h);
private static hexToR(h);
private static hexToG(h);
private static hexToB(h);
private static toHex(n);
}
}
declare module tx {
enum Roles {
generator = 0,
modifier = 1,
colorizer = 2,
combiner = 3,
special = 4,
}
enum Kinds {
pattern = 0,
renderer = 1,
math = 2,
transform = 3,
equalizer = 4,
noise = 5,
fractal = 6,
warp = 7,
blend = 8,
heightmap = 9,
calculator = 10,
cache = 11,
composer = 12,
colorscale = 13,
filter = 14,
constant = 15,
colorizer = 16,
}
enum Types {
bool = 0,
int = 1,
float = 2,
enumeration = 3,
function = 4,
texture = 5,
gradient = 6,
mixmap = 7,
formula = 8,
}
var LinkTypes: Array<Types>;
enum Families {
functions = 0,
textures = 1,
gradients = 2,
colors = 3,
renders = 4,
}
}
declare module tx {
interface IDtd {
render: IDtdRenders;
textures: IDtdFeatures;
functions: IDtdFeatures;
gradients: IGradients;
[key: string]: IDtdRenders | IGradients | IDtdFeatures;
}
interface IDtdCommon {
name?: string;
family?: string;
}
interface IDtdRender extends IDtdCommon {
params: IDtdParams;
}
interface IDtdFeature extends IDtdCommon {
role: Roles;
kind: Kinds;
is3d: boolean;
scale?: number;
invert?: boolean;
description?: string;
preview?: boolean;
params: IDtdParams;
}
interface IDtdParams {
[index: string]: IDtdParam;
}
interface IDtdRenders {
[index: string]: IDtdRender;
}
interface IDtdFeatures {
[index: string]: IDtdFeature;
}
interface IGradients {
[index: string]: IGradient;
}
interface IDtdParam {
type: Types;
min?: number;
max?: number;
value?: number | boolean | any[] | string;
values?: any;
optional?: boolean;
}
}
declare module tx {
var Dtd: IDtd;
}
declare module tx {
class DtdOverview {
private static _overview;
keys: Array<string>;
features: {
[index: string]: any;
};
ids: {
[index: string]: string;
};
static getOverview(): DtdOverview;
constructor();
private addKeys(obj);
private countParams(params);
private addIdAndFeatures(v);
}
}
declare module tx {
class DtdUtils {
static filter(role?: Roles, families?: IDtdFeatures[], preview?: boolean): IDtdFeature[];
static params(feature: IDtdFeature): IDtdParams;
static enums(params: IDtdParams): IDtdParams;
}
}
declare module tx {
interface IMapStop extends Array<number | string> {
}
interface IMixmap extends Array<IMapStop> {
}
}
declare module tx {
class Genetic extends Formula {
constructor(obj: Formula);
}
}
declare module tx {
class Mutator {
family: Families;
id: string;
property: string;
type: Types;
param: IDtdParam;
static getMutators(tree: Tree): Mutator[];
static countMutations(mutators: Mutator[], range?: number): number;
}
}
declare module tx {
class Generator {
formulas: Formula[];
constructor();
}
}
declare module tx {
class Random {
private static IA;
private static IM;
private static AM;
private static IQ;
private static IR;
private static NTAB;
private static NDIV;
private static EPS;
private static RNMX;
private iy;
private iv;
private idum;
private cached;
private cachevalue;
constructor(seed?: number);
Seed(seed: number): void;
Float(): number;
FloatRange(min: number, max: number): number;
Gauss(): number;
}
}
declare module tx {
class Partial {
family: Families;
id: string;
formula: Formula;
gradient: IGradient;
color: IColorStop;
parent: Partial;
data: IData;
constructor(family: Families, id: string, formula: Formula, data?: IData, gradient?: IGradient, color?: IColorStop, parent?: Partial);
}
}
declare module tx {
class TreeItem {
id: string;
label: string;
root: boolean;
collapsed: boolean;
children: Array<TreeItem>;
type: string;
data: any;
constructor(id: string, label: string, root?: boolean);
}
}
declare module tx {
class Tree {
formula: Formula;
items: Array<TreeItem>;
partials: Array<Partial>;
private lookup;
constructor(formula: Formula);
addRoot(rootValue: any, rootKey: string): void;
addChildrenId(id: string, value: TreeItem): void;
getChildren(type: string, family: string): Array<Array<string>>;
updateItem(rootValue: TreeItem): void;
updateTree(): void;
updatePartialsGradients(): void;
updatePartialsTextures(): void;
updatePartialsFunctions(): void;
updatePartials(): void;
randomizePart(item: TreeItem): void;
randomizeChildren(item: TreeItem): void;
}
}