aoi-comp 1.0.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/README.md +187 -0
- package/dist/BufferResource-CVU-ZRRz.js +273 -0
- package/dist/CanvasPool-C3aVgvEX.js +30 -0
- package/dist/CanvasRenderer-CVj7HTkL.js +3460 -0
- package/dist/Geometry-CN7W9DnD.js +3802 -0
- package/dist/RenderTargetSystem-D_FiZPnb.js +2572 -0
- package/dist/WebGLRenderer-CurPxJtF.js +2210 -0
- package/dist/WebGPURenderer-CfiYFIN2.js +1840 -0
- package/dist/browserAll-DqFkNC6q.js +977 -0
- package/dist/canvasUtils-D0KM_fKp.js +168 -0
- package/dist/comps.js +4459 -0
- package/dist/getTextureBatchBindGroup-CLFTP_Vc.js +19 -0
- package/dist/hooks-DByotZq7.js +452 -0
- package/dist/hooks.js +2 -0
- package/dist/index.js +2 -0
- package/dist/init-CIaGzij5.js +446 -0
- package/dist/init-DVXFVLyx.js +878 -0
- package/dist/packages-BbFWPD88.js +4002 -0
- package/dist/rolldown-runtime-CWhphoD1.js +23 -0
- package/dist/style.css +2 -0
- package/dist/utils.js +2 -0
- package/dist/webworkerAll-XSXRmCFC.js +2 -0
- package/package.json +65 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { $ as e, W as t, b as n, rt as r, z as i } from "./Geometry-CN7W9DnD.js";
|
|
2
|
+
//#region node_modules/.pnpm/pixi.js@8.20.1/node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/ImageSource.mjs
|
|
3
|
+
var a = class extends t {
|
|
4
|
+
constructor(e) {
|
|
5
|
+
super(e), this.uploadMethodId = "image", this.autoGarbageCollect = !0;
|
|
6
|
+
}
|
|
7
|
+
static test(e) {
|
|
8
|
+
return globalThis.HTMLImageElement && e instanceof HTMLImageElement || typeof ImageBitmap < "u" && e instanceof ImageBitmap || globalThis.VideoFrame && e instanceof VideoFrame;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
a.extension = r.TextureSource;
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region node_modules/.pnpm/pixi.js@8.20.1/node_modules/pixi.js/lib/rendering/renderers/canvas/utils/canUseNewCanvasBlendModes.mjs
|
|
14
|
+
var o;
|
|
15
|
+
function s(e) {
|
|
16
|
+
let t = n.get().createCanvas(6, 1), r = t.getContext("2d");
|
|
17
|
+
return r.fillStyle = e, r.fillRect(0, 0, 6, 1), t;
|
|
18
|
+
}
|
|
19
|
+
function c() {
|
|
20
|
+
if (o !== void 0) return o;
|
|
21
|
+
try {
|
|
22
|
+
let e = s("#ff00ff"), t = s("#ffff00"), r = n.get().createCanvas(6, 1).getContext("2d");
|
|
23
|
+
r.globalCompositeOperation = "multiply", r.drawImage(e, 0, 0), r.drawImage(t, 2, 0);
|
|
24
|
+
let i = r.getImageData(2, 0, 1, 1);
|
|
25
|
+
if (!i) o = !1;
|
|
26
|
+
else {
|
|
27
|
+
let e = i.data;
|
|
28
|
+
o = e[0] === 255 && e[1] === 0 && e[2] === 0;
|
|
29
|
+
}
|
|
30
|
+
} catch {
|
|
31
|
+
o = !1;
|
|
32
|
+
}
|
|
33
|
+
return o;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region node_modules/.pnpm/pixi.js@8.20.1/node_modules/pixi.js/lib/rendering/renderers/canvas/utils/canvasUtils.mjs
|
|
37
|
+
var l = {
|
|
38
|
+
canvas: null,
|
|
39
|
+
convertTintToImage: !1,
|
|
40
|
+
cacheStepsPerColorChannel: 8,
|
|
41
|
+
canUseMultiply: c(),
|
|
42
|
+
tintMethod: null,
|
|
43
|
+
_canvasSourceCache: /* @__PURE__ */ new WeakMap(),
|
|
44
|
+
_unpremultipliedCache: /* @__PURE__ */ new WeakMap(),
|
|
45
|
+
getCanvasSource: (e) => {
|
|
46
|
+
let t = e.source, r = t?.resource;
|
|
47
|
+
if (!r) return null;
|
|
48
|
+
let i = t.alphaMode === "premultiplied-alpha", a = t.resourceWidth ?? t.pixelWidth, o = t.resourceHeight ?? t.pixelHeight, s = a !== t.pixelWidth || o !== t.pixelHeight;
|
|
49
|
+
if (i) {
|
|
50
|
+
if ((r instanceof HTMLCanvasElement || typeof OffscreenCanvas < "u" && r instanceof OffscreenCanvas) && !s) return r;
|
|
51
|
+
let e = l._unpremultipliedCache.get(t);
|
|
52
|
+
if (e?.resourceId === t._resourceId) return e.canvas;
|
|
53
|
+
}
|
|
54
|
+
if (r instanceof Uint8Array || r instanceof Uint8ClampedArray || r instanceof Int8Array || r instanceof Uint16Array || r instanceof Int16Array || r instanceof Uint32Array || r instanceof Int32Array || r instanceof Float32Array || r instanceof ArrayBuffer) {
|
|
55
|
+
let e = l._canvasSourceCache.get(t);
|
|
56
|
+
if (e?.resourceId === t._resourceId) return e.canvas;
|
|
57
|
+
let i = n.get().createCanvas(t.pixelWidth, t.pixelHeight), a = i.getContext("2d"), o = a.createImageData(t.pixelWidth, t.pixelHeight), s = o.data, c = r instanceof ArrayBuffer ? new Uint8Array(r) : new Uint8Array(r.buffer, r.byteOffset, r.byteLength);
|
|
58
|
+
if (t.format === "bgra8unorm") for (let e = 0; e < s.length && e + 3 < c.length; e += 4) s[e] = c[e + 2], s[e + 1] = c[e + 1], s[e + 2] = c[e], s[e + 3] = c[e + 3];
|
|
59
|
+
else s.set(c.subarray(0, s.length));
|
|
60
|
+
return a.putImageData(o, 0, 0), l._canvasSourceCache.set(t, {
|
|
61
|
+
canvas: i,
|
|
62
|
+
resourceId: t._resourceId
|
|
63
|
+
}), i;
|
|
64
|
+
}
|
|
65
|
+
if (i) {
|
|
66
|
+
let e = n.get().createCanvas(t.pixelWidth, t.pixelHeight), i = e.getContext("2d", { willReadFrequently: !0 });
|
|
67
|
+
e.width = t.pixelWidth, e.height = t.pixelHeight, i.drawImage(r, 0, 0);
|
|
68
|
+
let a = i.getImageData(0, 0, e.width, e.height), o = a.data;
|
|
69
|
+
for (let e = 0; e < o.length; e += 4) {
|
|
70
|
+
let t = o[e + 3];
|
|
71
|
+
if (t > 0) {
|
|
72
|
+
let n = 255 / t;
|
|
73
|
+
o[e] = Math.min(255, o[e] * n + .5), o[e + 1] = Math.min(255, o[e + 1] * n + .5), o[e + 2] = Math.min(255, o[e + 2] * n + .5);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return i.putImageData(a, 0, 0), l._unpremultipliedCache.set(t, {
|
|
77
|
+
canvas: e,
|
|
78
|
+
resourceId: t._resourceId
|
|
79
|
+
}), e;
|
|
80
|
+
}
|
|
81
|
+
if (s) {
|
|
82
|
+
let e = l._canvasSourceCache.get(t);
|
|
83
|
+
if (e?.resourceId === t._resourceId) return e.canvas;
|
|
84
|
+
let i = n.get().createCanvas(t.pixelWidth, t.pixelHeight), a = i.getContext("2d");
|
|
85
|
+
return i.width = t.pixelWidth, i.height = t.pixelHeight, a.drawImage(r, 0, 0), l._canvasSourceCache.set(t, {
|
|
86
|
+
canvas: i,
|
|
87
|
+
resourceId: t._resourceId
|
|
88
|
+
}), i;
|
|
89
|
+
}
|
|
90
|
+
return r;
|
|
91
|
+
},
|
|
92
|
+
getTintedCanvas: (e, t) => {
|
|
93
|
+
let r = e.texture, a = i.shared.setValue(t).toHex(), o = r.tintCache ||= {}, s = o[a], c = r.source._resourceId;
|
|
94
|
+
if (s?.tintId === c) return s;
|
|
95
|
+
let u = s && "getContext" in s ? s : n.get().createCanvas();
|
|
96
|
+
if (l.tintMethod(r, t, u), u.tintId = c, l.convertTintToImage && u.toDataURL !== void 0) {
|
|
97
|
+
let e = n.get().createImage();
|
|
98
|
+
e.src = u.toDataURL(), e.tintId = c, o[a] = e;
|
|
99
|
+
} else o[a] = u;
|
|
100
|
+
return o[a];
|
|
101
|
+
},
|
|
102
|
+
getTintedPattern: (e, t) => {
|
|
103
|
+
let r = i.shared.setValue(t).toHex(), a = e.patternCache ||= {}, o = e.source._resourceId, s = a[r];
|
|
104
|
+
return s?.tintId === o ? s : (l.canvas ||= n.get().createCanvas(), l.tintMethod(e, t, l.canvas), s = l.canvas.getContext("2d").createPattern(l.canvas, "repeat"), s.tintId = o, a[r] = s, s);
|
|
105
|
+
},
|
|
106
|
+
applyPatternTransform: (e, t, n = !0) => {
|
|
107
|
+
if (!t) return;
|
|
108
|
+
let r = e;
|
|
109
|
+
if (!r.setTransform) return;
|
|
110
|
+
let i = globalThis.DOMMatrix;
|
|
111
|
+
if (!i) return;
|
|
112
|
+
let a = new i([
|
|
113
|
+
t.a,
|
|
114
|
+
t.b,
|
|
115
|
+
t.c,
|
|
116
|
+
t.d,
|
|
117
|
+
t.tx,
|
|
118
|
+
t.ty
|
|
119
|
+
]);
|
|
120
|
+
r.setTransform(n ? a.inverse() : a);
|
|
121
|
+
},
|
|
122
|
+
tintWithMultiply: (t, n, r) => {
|
|
123
|
+
let a = r.getContext("2d"), o = t.frame.clone(), s = t.source._resolution ?? t.source.resolution ?? 1, c = t.rotate;
|
|
124
|
+
o.x *= s, o.y *= s, o.width *= s, o.height *= s;
|
|
125
|
+
let u = e.isVertical(c), d = u ? o.height : o.width, f = u ? o.width : o.height;
|
|
126
|
+
r.width = Math.ceil(d), r.height = Math.ceil(f), a.save(), a.fillStyle = i.shared.setValue(n).toHex(), a.fillRect(0, 0, d, f), a.globalCompositeOperation = "multiply";
|
|
127
|
+
let p = l.getCanvasSource(t);
|
|
128
|
+
if (!p) {
|
|
129
|
+
a.restore();
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
c && l._applyInverseRotation(a, c, o.width, o.height), a.drawImage(p, o.x, o.y, o.width, o.height, 0, 0, o.width, o.height), a.globalCompositeOperation = "destination-atop", a.drawImage(p, o.x, o.y, o.width, o.height, 0, 0, o.width, o.height), a.restore();
|
|
133
|
+
},
|
|
134
|
+
tintWithOverlay: (t, n, r) => {
|
|
135
|
+
let a = r.getContext("2d"), o = t.frame.clone(), s = t.source._resolution ?? t.source.resolution ?? 1, c = t.rotate;
|
|
136
|
+
o.x *= s, o.y *= s, o.width *= s, o.height *= s;
|
|
137
|
+
let u = e.isVertical(c), d = u ? o.height : o.width, f = u ? o.width : o.height;
|
|
138
|
+
r.width = Math.ceil(d), r.height = Math.ceil(f), a.save(), a.globalCompositeOperation = "copy", a.fillStyle = i.shared.setValue(n).toHex(), a.fillRect(0, 0, d, f), a.globalCompositeOperation = "destination-atop";
|
|
139
|
+
let p = l.getCanvasSource(t);
|
|
140
|
+
if (!p) {
|
|
141
|
+
a.restore();
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
c && l._applyInverseRotation(a, c, o.width, o.height), a.drawImage(p, o.x, o.y, o.width, o.height, 0, 0, o.width, o.height), a.restore();
|
|
145
|
+
},
|
|
146
|
+
tintWithPerPixel: (t, n, r) => {
|
|
147
|
+
let i = r.getContext("2d"), a = t.frame.clone(), o = t.source._resolution ?? t.source.resolution ?? 1, s = t.rotate;
|
|
148
|
+
a.x *= o, a.y *= o, a.width *= o, a.height *= o;
|
|
149
|
+
let c = e.isVertical(s), u = c ? a.height : a.width, d = c ? a.width : a.height;
|
|
150
|
+
r.width = Math.ceil(u), r.height = Math.ceil(d), i.save(), i.globalCompositeOperation = "copy";
|
|
151
|
+
let f = l.getCanvasSource(t);
|
|
152
|
+
if (!f) {
|
|
153
|
+
i.restore();
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
s && l._applyInverseRotation(i, s, a.width, a.height), i.drawImage(f, a.x, a.y, a.width, a.height, 0, 0, a.width, a.height), i.restore();
|
|
157
|
+
let p = n >> 16 & 255, m = n >> 8 & 255, h = n & 255, g = i.getImageData(0, 0, u, d), _ = g.data;
|
|
158
|
+
for (let e = 0; e < _.length; e += 4) _[e] = _[e] * p / 255, _[e + 1] = _[e + 1] * m / 255, _[e + 2] = _[e + 2] * h / 255;
|
|
159
|
+
i.putImageData(g, 0, 0);
|
|
160
|
+
},
|
|
161
|
+
_applyInverseRotation: (t, n, r, i) => {
|
|
162
|
+
let a = e.inv(n), o = e.uX(a), s = e.uY(a), c = e.vX(a), l = e.vY(a), u = -Math.min(0, o * r, c * i, o * r + c * i), d = -Math.min(0, s * r, l * i, s * r + l * i);
|
|
163
|
+
t.transform(o, s, c, l, u, d);
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
l.tintMethod = l.canUseMultiply ? l.tintWithMultiply : l.tintWithPerPixel;
|
|
167
|
+
//#endregion
|
|
168
|
+
export { c as n, a as r, l as t };
|