@denisecase/mandart-wasm 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CITATION.cff +66 -0
- package/LICENSE +202 -0
- package/NOTICE +21 -0
- package/README.md +363 -2
- package/mandart_wasm.d.ts +253 -0
- package/mandart_wasm.js +956 -0
- package/mandart_wasm_bg.wasm +0 -0
- package/mandart_wasm_bg.wasm.d.ts +54 -0
- package/package.json +34 -4
- package/verification/numerical-agreement.json +1 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export interface ArtImageShapeInputs {
|
|
5
|
+
image_width: number;
|
|
6
|
+
image_height: number;
|
|
7
|
+
iterations_max: number;
|
|
8
|
+
scale: number;
|
|
9
|
+
x_center: number;
|
|
10
|
+
y_center: number;
|
|
11
|
+
theta: number;
|
|
12
|
+
r_sq_limit: number;
|
|
13
|
+
mand_power_real: number;
|
|
14
|
+
d_f_iter_min: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ColorPoint {
|
|
18
|
+
position: number;
|
|
19
|
+
color: string; // Hex color
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface Hue {
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
color_points: ColorPoint[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface ArtImageColorInputs {
|
|
29
|
+
n_blocks: number;
|
|
30
|
+
n_colors: number;
|
|
31
|
+
spacing_color_far: number;
|
|
32
|
+
spacing_color_near: number;
|
|
33
|
+
y_y_input: number;
|
|
34
|
+
mand_color: Float64Array;
|
|
35
|
+
// Note: colors and hues are accessed via methods
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface ColoredGrid {
|
|
39
|
+
grid: number[][][]; // 3D array: [x][y][rgb]
|
|
40
|
+
width: number;
|
|
41
|
+
height: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface ImageData {
|
|
45
|
+
data: Uint8Array; // RGBA data
|
|
46
|
+
width: number;
|
|
47
|
+
height: number;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface CombinedInputs {
|
|
51
|
+
shape_inputs: ArtImageShapeInputs;
|
|
52
|
+
color_inputs: ArtImageColorInputs;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface PictureDefinition {
|
|
56
|
+
id: string;
|
|
57
|
+
name: string;
|
|
58
|
+
createdDate: string;
|
|
59
|
+
modifiedDate: string;
|
|
60
|
+
imageWidth: number;
|
|
61
|
+
imageHeight: number;
|
|
62
|
+
iterationsMax: number;
|
|
63
|
+
scale: number;
|
|
64
|
+
xCenter: number;
|
|
65
|
+
yCenter: number;
|
|
66
|
+
theta: number;
|
|
67
|
+
rSqLimit: number;
|
|
68
|
+
mandPowerReal: number;
|
|
69
|
+
hues: Array<{
|
|
70
|
+
id: string;
|
|
71
|
+
name: string;
|
|
72
|
+
num: number;
|
|
73
|
+
r: number;
|
|
74
|
+
g: number;
|
|
75
|
+
b: number;
|
|
76
|
+
}>;
|
|
77
|
+
mandColor: {
|
|
78
|
+
r: number;
|
|
79
|
+
g: number;
|
|
80
|
+
b: number;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Represents color inputs in a WASM-compatible structure
|
|
88
|
+
*/
|
|
89
|
+
export class JsArtImageColorInputs {
|
|
90
|
+
free(): void;
|
|
91
|
+
[Symbol.dispose](): void;
|
|
92
|
+
constructor(n_blocks: number, n_colors: number, spacing_color_far: number, spacing_color_near: number, y_y_input: number, mand_color_js: Float64Array, colors_js: Array<any>, hues_js: Array<any>);
|
|
93
|
+
n_blocks: number;
|
|
94
|
+
n_colors: number;
|
|
95
|
+
spacing_color_far: number;
|
|
96
|
+
spacing_color_near: number;
|
|
97
|
+
y_y_input: number;
|
|
98
|
+
/**
|
|
99
|
+
* Get mand_color as Float64Array
|
|
100
|
+
*/
|
|
101
|
+
mand_color: Float64Array;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Represents shape inputs in a WASM-compatible structure
|
|
106
|
+
*/
|
|
107
|
+
export class JsArtImageShapeInputs {
|
|
108
|
+
free(): void;
|
|
109
|
+
[Symbol.dispose](): void;
|
|
110
|
+
constructor(image_width: number, image_height: number, iterations_max: number, scale: number, x_center: number, y_center: number, theta: number, r_sq_limit: number, mand_power_real: number, d_f_iter_min: number);
|
|
111
|
+
d_f_iter_min: number;
|
|
112
|
+
image_height: number;
|
|
113
|
+
image_width: number;
|
|
114
|
+
iterations_max: number;
|
|
115
|
+
mand_power_real: number;
|
|
116
|
+
r_sq_limit: number;
|
|
117
|
+
scale: number;
|
|
118
|
+
theta: number;
|
|
119
|
+
x_center: number;
|
|
120
|
+
y_center: number;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* **WASM API: Clear the grid cache**
|
|
125
|
+
*
|
|
126
|
+
* This function allows clients to explicitly clear the grid cache,
|
|
127
|
+
* which might be useful for low-memory situations.
|
|
128
|
+
*
|
|
129
|
+
* # Returns
|
|
130
|
+
* * The number of cache entries that were cleared
|
|
131
|
+
*/
|
|
132
|
+
export function api_clear_grid_cache(): number;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* **WASM API: Compute a Mandelbrot grid from shape inputs**
|
|
136
|
+
*
|
|
137
|
+
* Takes shape inputs from JavaScript and returns a 2D grid of iteration values.
|
|
138
|
+
*
|
|
139
|
+
* # Arguments
|
|
140
|
+
* * `js_inputs` - Shape inputs in JavaScript format
|
|
141
|
+
*
|
|
142
|
+
* # Returns
|
|
143
|
+
* * A 2D array of iteration values as a JsValue
|
|
144
|
+
*/
|
|
145
|
+
export function api_get_grid_from_shape_inputs(js_inputs: any): any;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* **WASM API: Generate an image directly from shape and color inputs**
|
|
149
|
+
*
|
|
150
|
+
* This function optimizes performance by caching uncolored grids and
|
|
151
|
+
* reusing them when possible.
|
|
152
|
+
*
|
|
153
|
+
* # Arguments
|
|
154
|
+
* * `js_shape_inputs` - Shape inputs in JavaScript format
|
|
155
|
+
* * `js_color_inputs` - Color inputs in JavaScript format
|
|
156
|
+
*
|
|
157
|
+
* # Returns
|
|
158
|
+
* * An image data structure as a JsValue
|
|
159
|
+
*/
|
|
160
|
+
export function api_get_image_from_inputs(js_shape_inputs: any, js_color_inputs: any): any;
|
|
161
|
+
|
|
162
|
+
export function api_get_inputs_from_picdef_string(picdef_json: string): any;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Returns version information about the MandArt library
|
|
166
|
+
*/
|
|
167
|
+
export function api_get_version(): string;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Exposes `load_or_compute_default_grid()` to JavaScript.
|
|
171
|
+
*/
|
|
172
|
+
export function api_load_or_compute_default_grid(): Float64Array;
|
|
173
|
+
|
|
174
|
+
export function init(): void;
|
|
175
|
+
|
|
176
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
177
|
+
|
|
178
|
+
export interface InitOutput {
|
|
179
|
+
readonly memory: WebAssembly.Memory;
|
|
180
|
+
readonly __wbg_get_jsartimagecolorinputs_n_blocks: (a: number) => number;
|
|
181
|
+
readonly __wbg_get_jsartimagecolorinputs_n_colors: (a: number) => number;
|
|
182
|
+
readonly __wbg_get_jsartimagecolorinputs_spacing_color_far: (a: number) => number;
|
|
183
|
+
readonly __wbg_get_jsartimagecolorinputs_spacing_color_near: (a: number) => number;
|
|
184
|
+
readonly __wbg_get_jsartimagecolorinputs_y_y_input: (a: number) => number;
|
|
185
|
+
readonly __wbg_get_jsartimageshapeinputs_d_f_iter_min: (a: number) => number;
|
|
186
|
+
readonly __wbg_get_jsartimageshapeinputs_image_height: (a: number) => number;
|
|
187
|
+
readonly __wbg_get_jsartimageshapeinputs_image_width: (a: number) => number;
|
|
188
|
+
readonly __wbg_get_jsartimageshapeinputs_iterations_max: (a: number) => number;
|
|
189
|
+
readonly __wbg_get_jsartimageshapeinputs_mand_power_real: (a: number) => number;
|
|
190
|
+
readonly __wbg_get_jsartimageshapeinputs_r_sq_limit: (a: number) => number;
|
|
191
|
+
readonly __wbg_get_jsartimageshapeinputs_scale: (a: number) => number;
|
|
192
|
+
readonly __wbg_get_jsartimageshapeinputs_theta: (a: number) => number;
|
|
193
|
+
readonly __wbg_get_jsartimageshapeinputs_x_center: (a: number) => number;
|
|
194
|
+
readonly __wbg_get_jsartimageshapeinputs_y_center: (a: number) => number;
|
|
195
|
+
readonly __wbg_jsartimagecolorinputs_free: (a: number, b: number) => void;
|
|
196
|
+
readonly __wbg_jsartimageshapeinputs_free: (a: number, b: number) => void;
|
|
197
|
+
readonly __wbg_set_jsartimagecolorinputs_n_blocks: (a: number, b: number) => void;
|
|
198
|
+
readonly __wbg_set_jsartimagecolorinputs_n_colors: (a: number, b: number) => void;
|
|
199
|
+
readonly __wbg_set_jsartimagecolorinputs_spacing_color_far: (a: number, b: number) => void;
|
|
200
|
+
readonly __wbg_set_jsartimagecolorinputs_spacing_color_near: (a: number, b: number) => void;
|
|
201
|
+
readonly __wbg_set_jsartimagecolorinputs_y_y_input: (a: number, b: number) => void;
|
|
202
|
+
readonly __wbg_set_jsartimageshapeinputs_d_f_iter_min: (a: number, b: number) => void;
|
|
203
|
+
readonly __wbg_set_jsartimageshapeinputs_image_height: (a: number, b: number) => void;
|
|
204
|
+
readonly __wbg_set_jsartimageshapeinputs_image_width: (a: number, b: number) => void;
|
|
205
|
+
readonly __wbg_set_jsartimageshapeinputs_iterations_max: (a: number, b: number) => void;
|
|
206
|
+
readonly __wbg_set_jsartimageshapeinputs_mand_power_real: (a: number, b: number) => void;
|
|
207
|
+
readonly __wbg_set_jsartimageshapeinputs_r_sq_limit: (a: number, b: number) => void;
|
|
208
|
+
readonly __wbg_set_jsartimageshapeinputs_scale: (a: number, b: number) => void;
|
|
209
|
+
readonly __wbg_set_jsartimageshapeinputs_theta: (a: number, b: number) => void;
|
|
210
|
+
readonly __wbg_set_jsartimageshapeinputs_x_center: (a: number, b: number) => void;
|
|
211
|
+
readonly __wbg_set_jsartimageshapeinputs_y_center: (a: number, b: number) => void;
|
|
212
|
+
readonly api_clear_grid_cache: () => number;
|
|
213
|
+
readonly api_get_grid_from_shape_inputs: (a: any) => [number, number, number];
|
|
214
|
+
readonly api_get_image_from_inputs: (a: any, b: any) => [number, number, number];
|
|
215
|
+
readonly api_get_inputs_from_picdef_string: (a: number, b: number) => any;
|
|
216
|
+
readonly api_get_version: () => [number, number];
|
|
217
|
+
readonly api_load_or_compute_default_grid: () => [number, number, number];
|
|
218
|
+
readonly init: () => void;
|
|
219
|
+
readonly jsartimagecolorinputs_mand_color: (a: number) => any;
|
|
220
|
+
readonly jsartimagecolorinputs_new: (a: number, b: number, c: number, d: number, e: number, f: any, g: any, h: any) => [number, number, number];
|
|
221
|
+
readonly jsartimagecolorinputs_set_mand_color: (a: number, b: any) => void;
|
|
222
|
+
readonly jsartimageshapeinputs_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => number;
|
|
223
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
224
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
225
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
226
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
227
|
+
readonly __externref_table_alloc: () => number;
|
|
228
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
229
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
230
|
+
readonly __wbindgen_start: () => void;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
237
|
+
* a precompiled `WebAssembly.Module`.
|
|
238
|
+
*
|
|
239
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
240
|
+
*
|
|
241
|
+
* @returns {InitOutput}
|
|
242
|
+
*/
|
|
243
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
247
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
248
|
+
*
|
|
249
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
250
|
+
*
|
|
251
|
+
* @returns {Promise<InitOutput>}
|
|
252
|
+
*/
|
|
253
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|