-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.mjs
52 lines (45 loc) · 991 Bytes
/
template.mjs
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
import fixValues from "../lib/fixValues.mjs";
import hexToArray from "../lib/hexToArray.mjs";
const optionFields = {
width: {
label: "Width",
nodeName: "INPUT",
type: "number",
min: 1,
max: 2048,
step: 1,
value: 256
},
height: {
label: "Height",
nodeName: "INPUT",
type: "number",
min: 1,
max: 2048,
step: 1,
value: 256
}
},
hexToArrayOpaque = hexToArray(0xff);
export default {
"Name": {
title: "",
description: "",
options: optionFields,
generator(ctx, { ...options }){
options = fixValues(options, optionFields);
const {
width,
height
} = options,
bitmap = new Uint8ClampedArray([]);
Object.assign(ctx.canvas, Object.freeze({
width,
height
}));
// …
ctx.putImageData(new ImageData(bitmap, width), 0, 0);
return options;
}
}
};