diff --git a/demo/images/colormap.png b/demo/images/colormap.png
new file mode 100644
index 000000000..122e07a52
Binary files /dev/null and b/demo/images/colormap.png differ
diff --git a/demo/images/displacement_BG.jpg b/demo/images/displacement_BG.jpg
new file mode 100644
index 000000000..7e666b203
Binary files /dev/null and b/demo/images/displacement_BG.jpg differ
diff --git a/demo/images/displacement_fish1.png b/demo/images/displacement_fish1.png
new file mode 100644
index 000000000..e7ddb254b
Binary files /dev/null and b/demo/images/displacement_fish1.png differ
diff --git a/demo/images/displacement_fish2.png b/demo/images/displacement_fish2.png
new file mode 100644
index 000000000..86f458be1
Binary files /dev/null and b/demo/images/displacement_fish2.png differ
diff --git a/demo/images/displacement_fish3.png b/demo/images/displacement_fish3.png
new file mode 100644
index 000000000..cdaf13523
Binary files /dev/null and b/demo/images/displacement_fish3.png differ
diff --git a/demo/images/displacement_fish4.png b/demo/images/displacement_fish4.png
new file mode 100644
index 000000000..fbba4af27
Binary files /dev/null and b/demo/images/displacement_fish4.png differ
diff --git a/demo/images/displacement_fish5.png b/demo/images/displacement_fish5.png
new file mode 100644
index 000000000..35e3f5860
Binary files /dev/null and b/demo/images/displacement_fish5.png differ
diff --git a/demo/images/displacement_map.png b/demo/images/displacement_map.png
new file mode 100644
index 000000000..efcc9490d
Binary files /dev/null and b/demo/images/displacement_map.png differ
diff --git a/demo/images/lightmap.png b/demo/images/lightmap.png
new file mode 100644
index 000000000..7cc852769
Binary files /dev/null and b/demo/images/lightmap.png differ
diff --git a/demo/images/overlay.png b/demo/images/overlay.png
new file mode 100644
index 000000000..0a3ed0f50
Binary files /dev/null and b/demo/images/overlay.png differ
diff --git a/demo/images/pixijs-logo.png b/demo/images/pixijs-logo.png
new file mode 100644
index 000000000..886cc017f
Binary files /dev/null and b/demo/images/pixijs-logo.png differ
diff --git a/demo/index.css b/demo/index.css
new file mode 100644
index 000000000..62588979b
--- /dev/null
+++ b/demo/index.css
@@ -0,0 +1,47 @@
+body {
+ margin:0;
+ padding:0;
+ font-family: Helvetica, sans-serif;
+ background:#333;
+ overflow: hidden;
+}
+#container {
+ top:0;
+ left:0;
+ width:100%;
+ height:100%;
+ position:absolute;
+ overflow: hidden;
+}
+#stage {
+ width:100%;
+ height:100%;
+ position:absolute;
+ display:block;
+ z-index: 0;
+}
+#logo {
+ position: absolute;
+ z-index:1;
+ width:245px;
+ height:69px;
+ top:0;
+ right:15px;
+ background:#000;
+ padding:10px 0;
+}
+.lil-gui.root {
+ top:89px !important;
+ max-height: calc(100% - 89px);
+}
+.lil-gui .title {
+ color: #999;
+}
+.lil-gui.enabled .title {
+ color: #ea4080;
+}
+#logo img {
+ display: block;
+ margin:8px auto 0;
+ width: 80%;
+}
\ No newline at end of file
diff --git a/demo/index.html b/demo/index.html
new file mode 100644
index 000000000..b459dde7a
--- /dev/null
+++ b/demo/index.html
@@ -0,0 +1,20 @@
+
+
+
+
+
+ PixiJS Filters Demo
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/demo/index.js b/demo/index.js
new file mode 100644
index 000000000..6d531dd91
--- /dev/null
+++ b/demo/index.js
@@ -0,0 +1,12997 @@
+(function (require$$0) {
+ 'use strict';
+
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
+
+ function _mergeNamespaces(n, m) {
+ m.forEach(function (e) {
+ e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
+ if (k !== 'default' && !(k in n)) {
+ var d = Object.getOwnPropertyDescriptor(e, k);
+ Object.defineProperty(n, k, d.get ? d : {
+ enumerable: true,
+ get: function () { return e[k]; }
+ });
+ }
+ });
+ });
+ return Object.freeze(n);
+ }
+
+ var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
+
+ var lib = {};
+
+ var AdjustmentFilter$2 = {};
+
+ var _default$A = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var vertex = "in vec2 aPosition;\nout vec2 vTextureCoord;\n\nuniform vec4 uInputSize;\nuniform vec4 uOutputFrame;\nuniform vec4 uOutputTexture;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n \n position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aPosition * (uOutputFrame.zw * uInputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n";
+ exports["default"] = vertex;
+ })(_default$A);
+
+ var default2 = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var wgslVertex = "struct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\nstruct VSOutput {\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n };\n\nfn filterVertexPosition(aPosition:vec2) -> vec4\n{\n var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n\n position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nfn filterTextureCoord( aPosition:vec2 ) -> vec2\n{\n return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n}\n\nfn globalTextureCoord( aPosition:vec2 ) -> vec2\n{\n return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); \n}\n\nfn getSize() -> vec2\n{\n return gfu.uGlobalFrame.zw;\n}\n \n@vertex\nfn mainVertex(\n @location(0) aPosition : vec2, \n) -> VSOutput {\n return VSOutput(\n filterVertexPosition(aPosition),\n filterTextureCoord(aPosition)\n );\n}";
+ exports["default"] = wgslVertex;
+ })(default2);
+
+ var adjustment$3 = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var fragment = "in vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform float uGamma;\nuniform float uContrast;\nuniform float uSaturation;\nuniform float uBrightness;\nuniform vec4 uColor;\n\nvoid main()\n{\n vec4 c = texture(uTexture, vTextureCoord);\n\n if (c.a > 0.0) {\n c.rgb /= c.a;\n\n vec3 rgb = pow(c.rgb, vec3(1. / uGamma));\n rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, uSaturation), uContrast);\n rgb.r *= uColor.r;\n rgb.g *= uColor.g;\n rgb.b *= uColor.b;\n c.rgb = rgb * uBrightness;\n\n c.rgb *= c.a;\n }\n\n finalColor = c * uColor.a;\n}\n";
+ exports["default"] = fragment;
+ })(adjustment$3);
+
+ var adjustment2 = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var source = "struct AdjustmentUniforms {\n uGamma: f32,\n uContrast: f32,\n uSaturation: f32,\n uBrightness: f32,\n uColor: vec4,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var adjustmentUniforms : AdjustmentUniforms;\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2,\n @builtin(position) position: vec4\n) -> @location(0) vec4 {\n var sample = textureSample(uTexture, uSampler, uv);\n let color = adjustmentUniforms.uColor;\n\n if (sample.a > 0.0) \n {\n sample = vec4(sample.rgb / sample.a, sample.a);\n var rgb: vec3 = pow(sample.rgb, vec3(1. / adjustmentUniforms.uGamma));\n rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, adjustmentUniforms.uSaturation), adjustmentUniforms.uContrast);\n rgb.r *= color.r;\n rgb.g *= color.g;\n rgb.b *= color.b;\n sample = vec4(rgb.rgb * adjustmentUniforms.uBrightness, sample.a);\n sample = vec4(sample.rgb * sample.a, sample.a);\n }\n\n return sample * color.a;\n}";
+ exports["default"] = source;
+ })(adjustment2);
+
+ var __defProp$14 = Object.defineProperty;
+ var __getOwnPropSymbols$x = Object.getOwnPropertySymbols;
+ var __hasOwnProp$x = Object.prototype.hasOwnProperty;
+ var __propIsEnum$x = Object.prototype.propertyIsEnumerable;
+ var __defNormalProp$14 = (obj, key, value) => key in obj ? __defProp$14(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+ var __spreadValues$x = (a, b) => {
+ for (var prop in b || (b = {}))
+ if (__hasOwnProp$x.call(b, prop))
+ __defNormalProp$14(a, prop, b[prop]);
+ if (__getOwnPropSymbols$x)
+ for (var prop of __getOwnPropSymbols$x(b)) {
+ if (__propIsEnum$x.call(b, prop))
+ __defNormalProp$14(a, prop, b[prop]);
+ }
+ return a;
+ };
+ Object.defineProperty(AdjustmentFilter$2, "__esModule", { value: true });
+ var pixi_js$B = require$$0__default["default"];
+ var _default$1$y = _default$A;
+ var _default$z = default2;
+ var adjustment$1 = adjustment$3;
+ var adjustment$2 = adjustment2;
+ var __defProp2$x = Object.defineProperty;
+ var __defNormalProp2$x = (obj, key, value) => key in obj ? __defProp2$x(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+ var __publicField$14 = (obj, key, value) => {
+ __defNormalProp2$x(obj, typeof key !== "symbol" ? key + "" : key, value);
+ return value;
+ };
+ const _AdjustmentFilter$1 = class _AdjustmentFilter2 extends pixi_js$B.Filter {
+ constructor(options) {
+ options = __spreadValues$x(__spreadValues$x({}, _AdjustmentFilter2.DEFAULT_OPTIONS), options);
+ const gpuProgram = new pixi_js$B.GpuProgram({
+ vertex: {
+ source: _default$z["default"],
+ entryPoint: "mainVertex"
+ },
+ fragment: {
+ source: adjustment$2["default"],
+ entryPoint: "mainFragment"
+ }
+ });
+ const glProgram = new pixi_js$B.GlProgram({
+ vertex: _default$1$y["default"],
+ fragment: adjustment$1["default"],
+ name: "adjustment-filter"
+ });
+ super({
+ gpuProgram,
+ glProgram,
+ resources: {
+ adjustmentUniforms: {
+ uGamma: { value: options.gamma, type: "f32" },
+ uContrast: { value: options.contrast, type: "f32" },
+ uSaturation: { value: options.saturation, type: "f32" },
+ uBrightness: { value: options.brightness, type: "f32" },
+ uColor: {
+ value: [
+ options.red,
+ options.green,
+ options.blue,
+ options.alpha
+ ],
+ type: "vec4"
+ }
+ }
+ }
+ });
+ __publicField$14(this, "uniforms");
+ this.uniforms = this.resources.adjustmentUniforms.uniforms;
+ }
+ /**
+ * Amount of luminance
+ * @default 1
+ */
+ get gamma() {
+ return this.uniforms.uGamma;
+ }
+ set gamma(value) {
+ this.uniforms.uGamma = value;
+ }
+ /**
+ * Amount of contrast
+ * @default 1
+ */
+ get contrast() {
+ return this.uniforms.uContrast;
+ }
+ set contrast(value) {
+ this.uniforms.uContrast = value;
+ }
+ /**
+ * Amount of color saturation
+ * @default 1
+ */
+ get saturation() {
+ return this.uniforms.uSaturation;
+ }
+ set saturation(value) {
+ this.uniforms.uSaturation = value;
+ }
+ /**
+ * The overall brightness
+ * @default 1
+ */
+ get brightness() {
+ return this.uniforms.uBrightness;
+ }
+ set brightness(value) {
+ this.uniforms.uBrightness = value;
+ }
+ /**
+ * The multiplied red channel
+ * @default 1
+ */
+ get red() {
+ return this.uniforms.uColor[0];
+ }
+ set red(value) {
+ this.uniforms.uColor[0] = value;
+ }
+ /**
+ * The multiplied blue channel
+ * @default 1
+ */
+ get green() {
+ return this.uniforms.uColor[1];
+ }
+ set green(value) {
+ this.uniforms.uColor[1] = value;
+ }
+ /**
+ * The multiplied green channel
+ * @default 1
+ */
+ get blue() {
+ return this.uniforms.uColor[2];
+ }
+ set blue(value) {
+ this.uniforms.uColor[2] = value;
+ }
+ /**
+ * The overall alpha channel
+ * @default 1
+ */
+ get alpha() {
+ return this.uniforms.uColor[3];
+ }
+ set alpha(value) {
+ this.uniforms.uColor[3] = value;
+ }
+ };
+ __publicField$14(_AdjustmentFilter$1, "DEFAULT_OPTIONS", {
+ gamma: 1,
+ contrast: 1,
+ saturation: 1,
+ brightness: 1,
+ red: 1,
+ green: 1,
+ blue: 1,
+ alpha: 1
+ });
+ let AdjustmentFilter$1 = _AdjustmentFilter$1;
+ AdjustmentFilter$2.AdjustmentFilter = AdjustmentFilter$1;
+
+ var AdvancedBloomFilter$2 = {};
+
+ var KawaseBlurFilter$5 = {};
+
+ var kawaseBlur$3 = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var fragment = "\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uOffset;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture(uTexture, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample top right pixel\n color += texture(uTexture, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample bottom right pixel\n color += texture(uTexture, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Sample bottom left pixel\n color += texture(uTexture, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Average\n color *= 0.25;\n\n finalColor = color;\n}";
+ exports["default"] = fragment;
+ })(kawaseBlur$3);
+
+ var kawaseBlur2 = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var source = "struct KawaseBlurUniforms {\n uOffset:vec2,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var kawaseBlurUniforms : KawaseBlurUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let uOffset = kawaseBlurUniforms.uOffset;\n var color: vec4 = vec4(0.0);\n\n // Sample top left pixel\n color += textureSample(uTexture, uSampler, vec2(uv.x - uOffset.x, uv.y + uOffset.y));\n // Sample top right pixel\n color += textureSample(uTexture, uSampler, vec2(uv.x + uOffset.x, uv.y + uOffset.y));\n // Sample bottom right pixel\n color += textureSample(uTexture, uSampler, vec2(uv.x + uOffset.x, uv.y - uOffset.y));\n // Sample bottom left pixel\n color += textureSample(uTexture, uSampler, vec2(uv.x - uOffset.x, uv.y - uOffset.y));\n // Average\n color *= 0.25;\n\n return color;\n}";
+ exports["default"] = source;
+ })(kawaseBlur2);
+
+ var kawaseBlurClamp$2 = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var fragmentClamp = "\nprecision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uOffset;\n\nuniform vec4 uInputClamp;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture(uTexture, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y), uInputClamp.xy, uInputClamp.zw));\n\n // Sample top right pixel\n color += texture(uTexture, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y), uInputClamp.xy, uInputClamp.zw));\n\n // Sample bottom right pixel\n color += texture(uTexture, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y), uInputClamp.xy, uInputClamp.zw));\n\n // Sample bottom left pixel\n color += texture(uTexture, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y), uInputClamp.xy, uInputClamp.zw));\n\n // Average\n color *= 0.25;\n\n finalColor = color;\n}\n";
+ exports["default"] = fragmentClamp;
+ })(kawaseBlurClamp$2);
+
+ var kawaseBlurClamp2 = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var sourceClamp = "struct KawaseBlurUniforms {\n uOffset:vec2,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var kawaseBlurUniforms : KawaseBlurUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let uOffset = kawaseBlurUniforms.uOffset;\n var color: vec4 = vec4(0.0);\n\n // Sample top left pixel\n color += textureSample(uTexture, uSampler, clamp(vec2(uv.x - uOffset.x, uv.y + uOffset.y), gfu.uInputClamp.xy, gfu.uInputClamp.zw));\n // Sample top right pixel\n color += textureSample(uTexture, uSampler, clamp(vec2(uv.x + uOffset.x, uv.y + uOffset.y), gfu.uInputClamp.xy, gfu.uInputClamp.zw));\n // Sample bottom right pixel\n color += textureSample(uTexture, uSampler, clamp(vec2(uv.x + uOffset.x, uv.y - uOffset.y), gfu.uInputClamp.xy, gfu.uInputClamp.zw));\n // Sample bottom left pixel\n color += textureSample(uTexture, uSampler, clamp(vec2(uv.x - uOffset.x, uv.y - uOffset.y), gfu.uInputClamp.xy, gfu.uInputClamp.zw));\n // Average\n color *= 0.25;\n \n return color;\n}";
+ exports["default"] = sourceClamp;
+ })(kawaseBlurClamp2);
+
+ var __defProp$13 = Object.defineProperty;
+ var __getOwnPropSymbols$w = Object.getOwnPropertySymbols;
+ var __hasOwnProp$w = Object.prototype.hasOwnProperty;
+ var __propIsEnum$w = Object.prototype.propertyIsEnumerable;
+ var __defNormalProp$13 = (obj, key, value) => key in obj ? __defProp$13(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+ var __spreadValues$w = (a, b) => {
+ for (var prop in b || (b = {}))
+ if (__hasOwnProp$w.call(b, prop))
+ __defNormalProp$13(a, prop, b[prop]);
+ if (__getOwnPropSymbols$w)
+ for (var prop of __getOwnPropSymbols$w(b)) {
+ if (__propIsEnum$w.call(b, prop))
+ __defNormalProp$13(a, prop, b[prop]);
+ }
+ return a;
+ };
+ Object.defineProperty(KawaseBlurFilter$5, "__esModule", { value: true });
+ var pixi_js$A = require$$0__default["default"];
+ var _default$1$x = _default$A;
+ var _default$y = default2;
+ var kawaseBlur$1 = kawaseBlur$3;
+ var kawaseBlur$2 = kawaseBlur2;
+ var kawaseBlurClamp$1 = kawaseBlurClamp$2;
+ var kawaseBlurClamp = kawaseBlurClamp2;
+ var __defProp2$w = Object.defineProperty;
+ var __defNormalProp2$w = (obj, key, value) => key in obj ? __defProp2$w(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+ var __publicField$13 = (obj, key, value) => {
+ __defNormalProp2$w(obj, typeof key !== "symbol" ? key + "" : key, value);
+ return value;
+ };
+ const _KawaseBlurFilter$1 = class _KawaseBlurFilter2 extends pixi_js$A.Filter {
+ constructor(options) {
+ var _a, _b;
+ options = __spreadValues$w(__spreadValues$w({}, _KawaseBlurFilter2.DEFAULT_OPTIONS), options);
+ const gpuProgram = new pixi_js$A.GpuProgram({
+ vertex: {
+ source: _default$y["default"],
+ entryPoint: "mainVertex"
+ },
+ fragment: {
+ source: (options == null ? void 0 : options.clamp) ? kawaseBlurClamp["default"] : kawaseBlur$2["default"],
+ entryPoint: "mainFragment"
+ }
+ });
+ const glProgram = new pixi_js$A.GlProgram({
+ vertex: _default$1$x["default"],
+ fragment: (options == null ? void 0 : options.clamp) ? kawaseBlurClamp$1["default"] : kawaseBlur$1["default"],
+ name: "kawase-blur-filter"
+ });
+ super({
+ gpuProgram,
+ glProgram,
+ resources: {
+ kawaseBlurUniforms: {
+ uOffset: { value: new Float32Array(2), type: "vec2" }
+ }
+ }
+ });
+ __publicField$13(this, "uniforms");
+ __publicField$13(this, "_pixelSize", { x: 0, y: 0 });
+ __publicField$13(this, "_clamp");
+ __publicField$13(this, "_kernels", []);
+ __publicField$13(this, "_blur");
+ __publicField$13(this, "_quality");
+ this.uniforms = this.resources.kawaseBlurUniforms.uniforms;
+ this._pixelSize = (_a = options.pixelSize) != null ? _a : { x: 1, y: 1 };
+ if (Array.isArray(options.strength)) {
+ this.kernels = options.strength;
+ } else if (typeof options.strength === "number") {
+ this._blur = options.strength;
+ this.quality = (_b = options.quality) != null ? _b : 3;
+ }
+ this._clamp = !!options.clamp;
+ }
+ /**
+ * Override existing apply method in `Filter`
+ * @override
+ * @ignore
+ */
+ apply(filterManager, input, output, clearMode) {
+ const uvX = this.pixelSizeX / input.source.width;
+ const uvY = this.pixelSizeY / input.source.height;
+ let offset;
+ if (this._quality === 1 || this._blur === 0) {
+ offset = this._kernels[0] + 0.5;
+ this.uniforms.uOffset[0] = offset * uvX;
+ this.uniforms.uOffset[1] = offset * uvY;
+ filterManager.applyFilter(this, input, output, clearMode);
+ } else {
+ const renderTarget = pixi_js$A.TexturePool.getSameSizeTexture(input);
+ let source2 = input;
+ let target = renderTarget;
+ let tmp;
+ const last = this._quality - 1;
+ for (let i = 0; i < last; i++) {
+ offset = this._kernels[i] + 0.5;
+ this.uniforms.uOffset[0] = offset * uvX;
+ this.uniforms.uOffset[1] = offset * uvY;
+ filterManager.applyFilter(this, source2, target, true);
+ tmp = source2;
+ source2 = target;
+ target = tmp;
+ }
+ offset = this._kernels[last] + 0.5;
+ this.uniforms.uOffset[0] = offset * uvX;
+ this.uniforms.uOffset[1] = offset * uvY;
+ filterManager.applyFilter(this, source2, output, clearMode);
+ pixi_js$A.TexturePool.returnTexture(renderTarget);
+ }
+ }
+ /**
+ * The amount of blur, value greater than `0`.
+ * @default 4
+ */
+ get strength() {
+ return this._blur;
+ }
+ set strength(value) {
+ this._blur = value;
+ this._generateKernels();
+ }
+ /**
+ * The quality of the filter, integer greater than `1`.
+ * @default 3
+ */
+ get quality() {
+ return this._quality;
+ }
+ set quality(value) {
+ this._quality = Math.max(1, Math.round(value));
+ this._generateKernels();
+ }
+ /**
+ * The kernel size of the blur filter, for advanced usage
+ * @default [0]
+ */
+ get kernels() {
+ return this._kernels;
+ }
+ set kernels(value) {
+ if (Array.isArray(value) && value.length > 0) {
+ this._kernels = value;
+ this._quality = value.length;
+ this._blur = Math.max(...value);
+ } else {
+ this._kernels = [0];
+ this._quality = 1;
+ }
+ }
+ /**
+ * The size of the pixels. Large size is blurrier. For advanced usage.
+ * @default {x:1,y:1}
+ */
+ get pixelSize() {
+ return this._pixelSize;
+ }
+ set pixelSize(value) {
+ this._pixelSize = value;
+ }
+ /**
+ * The size of the pixels on the `x` axis. Large size is blurrier. For advanced usage.
+ * @default 1
+ */
+ get pixelSizeX() {
+ return this.pixelSize.x;
+ }
+ set pixelSizeX(value) {
+ this.pixelSize.x = value;
+ }
+ /**
+ * The size of the pixels on the `y` axis. Large size is blurrier. For advanced usage.
+ * @default 1
+ */
+ get pixelSizeY() {
+ return this.pixelSize.y;
+ }
+ set pixelSizeY(value) {
+ this.pixelSize.y = value;
+ }
+ /**
+ * Get the if the filter is clamped
+ * @default false
+ */
+ get clamp() {
+ return this._clamp;
+ }
+ /** Update padding based on kernel data */
+ _updatePadding() {
+ this.padding = Math.ceil(this._kernels.reduce((acc, v) => acc + v + 0.5, 0));
+ }
+ /** Auto generate kernels by blur & quality */
+ _generateKernels() {
+ const blur = this._blur;
+ const quality = this._quality;
+ const kernels = [blur];
+ if (blur > 0) {
+ let k = blur;
+ const step = blur / quality;
+ for (let i = 1; i < quality; i++) {
+ k -= step;
+ kernels.push(k);
+ }
+ }
+ this._kernels = kernels;
+ this._updatePadding();
+ }
+ };
+ __publicField$13(_KawaseBlurFilter$1, "DEFAULT_OPTIONS", {
+ strength: 4,
+ quality: 3,
+ clamp: false,
+ pixelSize: { x: 1, y: 1 }
+ });
+ let KawaseBlurFilter$4 = _KawaseBlurFilter$1;
+ KawaseBlurFilter$5.KawaseBlurFilter = KawaseBlurFilter$4;
+
+ var advancedBloom2 = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var fragment = "in vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform sampler2D uMapTexture;\nuniform float uBloomScale;\nuniform float uBrightness;\n\nvoid main() {\n vec4 color = texture(uTexture, vTextureCoord);\n color.rgb *= uBrightness;\n vec4 bloomColor = vec4(texture(uMapTexture, vTextureCoord).rgb, 0.0);\n bloomColor.rgb *= uBloomScale;\n finalColor = color + bloomColor;\n}\n";
+ exports["default"] = fragment;
+ })(advancedBloom2);
+
+ var advancedBloom$3 = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var source = "struct AdvancedBloomUniforms {\n uBloomScale: f32,\n uBrightness: f32,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var advancedBloomUniforms : AdvancedBloomUniforms;\n@group(1) @binding(1) var uMapTexture: texture_2d;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n var color = textureSample(uTexture, uSampler, uv);\n color = vec4(color.rgb * advancedBloomUniforms.uBrightness, color.a);\n\n var bloomColor = vec4(textureSample(uMapTexture, uSampler, uv).rgb, 0.0);\n bloomColor = vec4(bloomColor.rgb * advancedBloomUniforms.uBloomScale, bloomColor.a);\n \n return color + bloomColor;\n}\n";
+ exports["default"] = source;
+ })(advancedBloom$3);
+
+ var ExtractBrightnessFilter$3 = {};
+
+ var extractBrightness$2 = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var fragment = "\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform float uThreshold;\n\nvoid main() {\n vec4 color = texture(uTexture, vTextureCoord);\n\n // A simple & fast algorithm for getting brightness.\n // It's inaccuracy , but good enought for this feature.\n float _max = max(max(color.r, color.g), color.b);\n float _min = min(min(color.r, color.g), color.b);\n float brightness = (_max + _min) * 0.5;\n\n if(brightness > uThreshold) {\n finalColor = color;\n } else {\n finalColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n}\n";
+ exports["default"] = fragment;
+ })(extractBrightness$2);
+
+ var extractBrightness2 = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var source = "struct ExtractBrightnessUniforms {\n uThreshold: f32,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var extractBrightnessUniforms : ExtractBrightnessUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let color: vec4 = textureSample(uTexture, uSampler, uv);\n\n // A simple & fast algorithm for getting brightness.\n // It's inaccurate, but good enough for this feature.\n let max: f32 = max(max(color.r, color.g), color.b);\n let min: f32 = min(min(color.r, color.g), color.b);\n let brightness: f32 = (max + min) * 0.5;\n\n return select(vec4(0.), color, brightness > extractBrightnessUniforms.uThreshold);\n}\n";
+ exports["default"] = source;
+ })(extractBrightness2);
+
+ var __defProp$12 = Object.defineProperty;
+ var __getOwnPropSymbols$v = Object.getOwnPropertySymbols;
+ var __hasOwnProp$v = Object.prototype.hasOwnProperty;
+ var __propIsEnum$v = Object.prototype.propertyIsEnumerable;
+ var __defNormalProp$12 = (obj, key, value) => key in obj ? __defProp$12(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+ var __spreadValues$v = (a, b) => {
+ for (var prop in b || (b = {}))
+ if (__hasOwnProp$v.call(b, prop))
+ __defNormalProp$12(a, prop, b[prop]);
+ if (__getOwnPropSymbols$v)
+ for (var prop of __getOwnPropSymbols$v(b)) {
+ if (__propIsEnum$v.call(b, prop))
+ __defNormalProp$12(a, prop, b[prop]);
+ }
+ return a;
+ };
+ Object.defineProperty(ExtractBrightnessFilter$3, "__esModule", { value: true });
+ var pixi_js$z = require$$0__default["default"];
+ var _default$1$w = _default$A;
+ var _default$x = default2;
+ var extractBrightness$1 = extractBrightness$2;
+ var extractBrightness = extractBrightness2;
+ var __defProp2$v = Object.defineProperty;
+ var __defNormalProp2$v = (obj, key, value) => key in obj ? __defProp2$v(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+ var __publicField$12 = (obj, key, value) => {
+ __defNormalProp2$v(obj, typeof key !== "symbol" ? key + "" : key, value);
+ return value;
+ };
+ const _ExtractBrightnessFilter$1 = class _ExtractBrightnessFilter2 extends pixi_js$z.Filter {
+ constructor(options) {
+ options = __spreadValues$v(__spreadValues$v({}, _ExtractBrightnessFilter2.DEFAULT_OPTIONS), options);
+ const gpuProgram = new pixi_js$z.GpuProgram({
+ vertex: {
+ source: _default$x["default"],
+ entryPoint: "mainVertex"
+ },
+ fragment: {
+ source: extractBrightness["default"],
+ entryPoint: "mainFragment"
+ }
+ });
+ const glProgram = new pixi_js$z.GlProgram({
+ vertex: _default$1$w["default"],
+ fragment: extractBrightness$1["default"],
+ name: "extract-brightness-filter"
+ });
+ super({
+ gpuProgram,
+ glProgram,
+ resources: {
+ extractBrightnessUniforms: {
+ uThreshold: { value: options.threshold, type: "f32" }
+ }
+ }
+ });
+ __publicField$12(this, "uniforms");
+ this.uniforms = this.resources.extractBrightnessUniforms.uniforms;
+ }
+ /**
+ * Defines how bright a color needs to be extracted.
+ * @default 0.5
+ */
+ get threshold() {
+ return this.uniforms.uThreshold;
+ }
+ set threshold(value) {
+ this.uniforms.uThreshold = value;
+ }
+ };
+ __publicField$12(_ExtractBrightnessFilter$1, "DEFAULT_OPTIONS", {
+ threshold: 0.5
+ });
+ let ExtractBrightnessFilter$2 = _ExtractBrightnessFilter$1;
+ ExtractBrightnessFilter$3.ExtractBrightnessFilter = ExtractBrightnessFilter$2;
+
+ var __defProp$11 = Object.defineProperty;
+ var __getOwnPropSymbols$u = Object.getOwnPropertySymbols;
+ var __hasOwnProp$u = Object.prototype.hasOwnProperty;
+ var __propIsEnum$u = Object.prototype.propertyIsEnumerable;
+ var __defNormalProp$11 = (obj, key, value) => key in obj ? __defProp$11(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+ var __spreadValues$u = (a, b) => {
+ for (var prop in b || (b = {}))
+ if (__hasOwnProp$u.call(b, prop))
+ __defNormalProp$11(a, prop, b[prop]);
+ if (__getOwnPropSymbols$u)
+ for (var prop of __getOwnPropSymbols$u(b)) {
+ if (__propIsEnum$u.call(b, prop))
+ __defNormalProp$11(a, prop, b[prop]);
+ }
+ return a;
+ };
+ Object.defineProperty(AdvancedBloomFilter$2, "__esModule", { value: true });
+ var pixi_js$y = require$$0__default["default"];
+ var _default$1$v = _default$A;
+ var _default$w = default2;
+ var KawaseBlurFilter$3 = KawaseBlurFilter$5;
+ var advancedBloom$1 = advancedBloom2;
+ var advancedBloom$2 = advancedBloom$3;
+ var ExtractBrightnessFilter$1 = ExtractBrightnessFilter$3;
+ var __defProp2$u = Object.defineProperty;
+ var __defNormalProp2$u = (obj, key, value) => key in obj ? __defProp2$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+ var __publicField$11 = (obj, key, value) => {
+ __defNormalProp2$u(obj, typeof key !== "symbol" ? key + "" : key, value);
+ return value;
+ };
+ const _AdvancedBloomFilter$1 = class _AdvancedBloomFilter2 extends pixi_js$y.Filter {
+ constructor(options) {
+ var _a;
+ options = __spreadValues$u(__spreadValues$u({}, _AdvancedBloomFilter2.DEFAULT_OPTIONS), options);
+ const gpuProgram = new pixi_js$y.GpuProgram({
+ vertex: {
+ source: _default$w["default"],
+ entryPoint: "mainVertex"
+ },
+ fragment: {
+ source: advancedBloom$2["default"],
+ entryPoint: "mainFragment"
+ }
+ });
+ const glProgram = new pixi_js$y.GlProgram({
+ vertex: _default$1$v["default"],
+ fragment: advancedBloom$1["default"],
+ name: "advanced-bloom-filter"
+ });
+ super({
+ gpuProgram,
+ glProgram,
+ resources: {
+ advancedBloomUniforms: {
+ uBloomScale: { value: options.bloomScale, type: "f32" },
+ uBrightness: { value: options.brightness, type: "f32" }
+ },
+ uMapTexture: pixi_js$y.Texture.WHITE
+ }
+ });
+ __publicField$11(this, "uniforms");
+ __publicField$11(this, "bloomScale", 1);
+ __publicField$11(this, "brightness", 1);
+ __publicField$11(this, "_extractFilter");
+ __publicField$11(this, "_blurFilter");
+ this.uniforms = this.resources.advancedBloomUniforms.uniforms;
+ this._extractFilter = new ExtractBrightnessFilter$1.ExtractBrightnessFilter({
+ threshold: options.threshold
+ });
+ this._blurFilter = new KawaseBlurFilter$3.KawaseBlurFilter({
+ strength: (_a = options.kernels) != null ? _a : options.blur,
+ quality: options.kernels ? void 0 : options.quality
+ });
+ Object.assign(this, options);
+ }
+ /**
+ * Override existing apply method in `Filter`
+ * @override
+ * @ignore
+ */
+ apply(filterManager, input, output, clearMode) {
+ const brightTarget = pixi_js$y.TexturePool.getSameSizeTexture(input);
+ this._extractFilter.apply(filterManager, input, brightTarget, true);
+ const bloomTarget = pixi_js$y.TexturePool.getSameSizeTexture(input);
+ this._blurFilter.apply(filterManager, brightTarget, bloomTarget, true);
+ this.uniforms.uBloomScale = this.bloomScale;
+ this.uniforms.uBrightness = this.brightness;
+ this.resources.uMapTexture = bloomTarget.source;
+ filterManager.applyFilter(this, input, output, clearMode);
+ pixi_js$y.TexturePool.returnTexture(bloomTarget);
+ pixi_js$y.TexturePool.returnTexture(brightTarget);
+ }
+ /**
+ * Defines how bright a color needs to be extracted.
+ * @default 0.5
+ */
+ get threshold() {
+ return this._extractFilter.threshold;
+ }
+ set threshold(value) {
+ this._extractFilter.threshold = value;
+ }
+ /** Sets the kernels of the Blur Filter */
+ get kernels() {
+ return this._blurFilter.kernels;
+ }
+ set kernels(value) {
+ this._blurFilter.kernels = value;
+ }
+ /**
+ * Sets the strength of the Blur properties simultaneously
+ * @default 2
+ */
+ get blur() {
+ return this._blurFilter.strength;
+ }
+ set blur(value) {
+ this._blurFilter.strength = value;
+ }
+ /**
+ * Sets the quality of the Blur Filter
+ * @default 4
+ */
+ get quality() {
+ return this._blurFilter.quality;
+ }
+ set quality(value) {
+ this._blurFilter.quality = value;
+ }
+ /**
+ * Sets the pixelSize of the Kawase Blur filter
+ * @default {x:1,y:1}
+ */
+ get pixelSize() {
+ return this._blurFilter.pixelSize;
+ }
+ set pixelSize(value) {
+ this._blurFilter.pixelSize = value;
+ }
+ /**
+ * Sets the pixelSize of the Kawase Blur filter on the `x` axis
+ * @default 1
+ */
+ get pixelSizeX() {
+ return this._blurFilter.pixelSizeX;
+ }
+ set pixelSizeX(value) {
+ this._blurFilter.pixelSizeX = value;
+ }
+ /**
+ * Sets the pixelSize of the Kawase Blur filter on the `y` axis
+ * @default 1
+ */
+ get pixelSizeY() {
+ return this._blurFilter.pixelSizeY;
+ }
+ set pixelSizeY(value) {
+ this._blurFilter.pixelSizeY = value;
+ }
+ };
+ __publicField$11(_AdvancedBloomFilter$1, "DEFAULT_OPTIONS", {
+ threshold: 0.5,
+ bloomScale: 1,
+ brightness: 1,
+ blur: 8,
+ quality: 4,
+ pixelSize: { x: 1, y: 1 }
+ });
+ let AdvancedBloomFilter$1 = _AdvancedBloomFilter$1;
+ AdvancedBloomFilter$2.AdvancedBloomFilter = AdvancedBloomFilter$1;
+
+ var AsciiFilter$2 = {};
+
+ var ascii$3 = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var fragment = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform float uSize;\nuniform vec3 uColor;\nuniform float uReplaceColor;\n\nuniform vec4 uInputSize;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= uInputSize.xy;\n coord += uInputSize.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= uInputSize.zw;\n coord /= uInputSize.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n return floor(coord / size) * size;\n}\n\nvec2 getMod(vec2 coord, vec2 size)\n{\n return mod(coord, size) / size;\n}\n\nfloat character(float n, vec2 p)\n{\n p = floor(p*vec2(4.0, 4.0) + 2.5);\n\n if (clamp(p.x, 0.0, 4.0) == p.x)\n {\n if (clamp(p.y, 0.0, 4.0) == p.y)\n {\n if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0;\n }\n }\n return 0.0;\n}\n\nvoid main()\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n // get the grid position\n vec2 pixCoord = pixelate(coord, vec2(uSize));\n pixCoord = unmapCoord(pixCoord);\n\n // sample the color at grid position\n vec4 color = texture(uTexture, pixCoord);\n\n // brightness of the color as it's perceived by the human eye\n float gray = 0.3 * color.r + 0.59 * color.g + 0.11 * color.b;\n\n // determine the character to use\n float n = 65536.0; // .\n if (gray > 0.2) n = 65600.0; // :\n if (gray > 0.3) n = 332772.0; // *\n if (gray > 0.4) n = 15255086.0; // o\n if (gray > 0.5) n = 23385164.0; // &\n if (gray > 0.6) n = 15252014.0; // 8\n if (gray > 0.7) n = 13199452.0; // @\n if (gray > 0.8) n = 11512810.0; // #\n\n // get the mod..\n vec2 modd = getMod(coord, vec2(uSize));\n\n finalColor = (uReplaceColor > 0.5 ? vec4(uColor, 1.) : color) * character( n, vec2(-1.0) + modd * 2.0);\n}\n";
+ exports["default"] = fragment;
+ })(ascii$3);
+
+ var ascii2 = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var source = "struct AsciiUniforms {\n uSize: f32,\n uColor: vec3,\n uReplaceColor: f32,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var asciiUniforms : AsciiUniforms;\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2,\n @builtin(position) position: vec4\n) -> @location(0) vec4 {\n let pixelSize: f32 = asciiUniforms.uSize;\n let coord: vec2 = mapCoord(uv);\n\n // get the rounded color..\n var pixCoord: vec2 = pixelate(coord, vec2(pixelSize));\n pixCoord = unmapCoord(pixCoord);\n\n var color = textureSample(uTexture, uSampler, pixCoord);\n\n // determine the character to use\n let gray: f32 = 0.3 * color.r + 0.59 * color.g + 0.11 * color.b;\n \n var n: f32 = 65536.0; // .\n if (gray > 0.2) {\n n = 65600.0; // :\n }\n if (gray > 0.3) {\n n = 332772.0; // *\n }\n if (gray > 0.4) {\n n = 15255086.0; // o\n }\n if (gray > 0.5) {\n n = 23385164.0; // &\n }\n if (gray > 0.6) {\n n = 15252014.0; // 8\n }\n if (gray > 0.7) {\n n = 13199452.0; // @\n }\n if (gray > 0.8) {\n n = 11512810.0; // #\n }\n\n // get the mod..\n let modd: vec2 = getMod(coord, vec2(pixelSize));\n return select(color, vec4(asciiUniforms.uColor, 1.), asciiUniforms.uReplaceColor > 0.5) * character(n, vec2(-1.0) + modd * 2.0);\n}\n\nfn pixelate(coord: vec2, size: vec2) -> vec2\n{\n return floor( coord / size ) * size;\n}\n\nfn getMod(coord: vec2, size: vec2) -> vec2\n{\n return moduloVec2( coord , size) / size;\n}\n\nfn character(n: f32, p: vec2) -> f32\n{\n var q: vec2 = floor(p*vec2(4.0, 4.0) + 2.5);\n\n if (clamp(q.x, 0.0, 4.0) == q.x)\n {\n if (clamp(q.y, 0.0, 4.0) == q.y)\n {\n if (i32(modulo(n/exp2(q.x + 5.0*q.y), 2.0)) == 1)\n {\n return 1.0;\n }\n }\n }\n\n return 0.0;\n}\n\nfn modulo(x: f32, y: f32) -> f32\n{\n return x - y * floor(x/y);\n}\n\nfn moduloVec2(x: vec2, y: vec2) -> vec2\n{\n return x - y * floor(x/y);\n}\n\nfn mapCoord(coord: vec2 ) -> vec2\n{\n var mappedCoord: vec2 = coord;\n mappedCoord *= gfu.uInputSize.xy;\n mappedCoord += gfu.uOutputFrame.xy;\n return mappedCoord;\n}\n\nfn unmapCoord(coord: vec2 ) -> vec2\n{\n var mappedCoord: vec2 = coord;\n mappedCoord -= gfu.uOutputFrame.xy;\n mappedCoord /= gfu.uInputSize.xy;\n return mappedCoord;\n}";
+ exports["default"] = source;
+ })(ascii2);
+
+ var __defProp$10 = Object.defineProperty;
+ var __getOwnPropSymbols$t = Object.getOwnPropertySymbols;
+ var __hasOwnProp$t = Object.prototype.hasOwnProperty;
+ var __propIsEnum$t = Object.prototype.propertyIsEnumerable;
+ var __defNormalProp$10 = (obj, key, value) => key in obj ? __defProp$10(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+ var __spreadValues$t = (a, b) => {
+ for (var prop in b || (b = {}))
+ if (__hasOwnProp$t.call(b, prop))
+ __defNormalProp$10(a, prop, b[prop]);
+ if (__getOwnPropSymbols$t)
+ for (var prop of __getOwnPropSymbols$t(b)) {
+ if (__propIsEnum$t.call(b, prop))
+ __defNormalProp$10(a, prop, b[prop]);
+ }
+ return a;
+ };
+ Object.defineProperty(AsciiFilter$2, "__esModule", { value: true });
+ var pixi_js$x = require$$0__default["default"];
+ var _default$1$u = _default$A;
+ var _default$v = default2;
+ var ascii$1 = ascii$3;
+ var ascii$2 = ascii2;
+ var __defProp2$t = Object.defineProperty;
+ var __defNormalProp2$t = (obj, key, value) => key in obj ? __defProp2$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+ var __publicField$10 = (obj, key, value) => {
+ __defNormalProp2$t(obj, typeof key !== "symbol" ? key + "" : key, value);
+ return value;
+ };
+ const _AsciiFilter$1 = class _AsciiFilter2 extends pixi_js$x.Filter {
+ constructor(options) {
+ var _a;
+ const replaceColor = (options == null ? void 0 : options.color) && options.replaceColor !== false;
+ options = __spreadValues$t(__spreadValues$t({}, _AsciiFilter2.DEFAULT_OPTIONS), options);
+ const gpuProgram = new pixi_js$x.GpuProgram({
+ vertex: {
+ source: _default$v["default"],
+ entryPoint: "mainVertex"
+ },
+ fragment: {
+ source: ascii$2["default"],
+ entryPoint: "mainFragment"
+ }
+ });
+ const glProgram = new pixi_js$x.GlProgram({
+ vertex: _default$1$u["default"],
+ fragment: ascii$1["default"],
+ name: "ascii-filter"
+ });
+ super({
+ gpuProgram,
+ glProgram,
+ resources: {
+ asciiUniforms: {
+ uSize: { value: options.size, type: "f32" },
+ uColor: { value: new Float32Array(3), type: "vec3" },
+ uReplaceColor: { value: Number(replaceColor), type: "f32" }
+ }
+ }
+ });
+ __publicField$10(this, "uniforms");
+ __publicField$10(this, "_color");
+ this.uniforms = this.resources.asciiUniforms.uniforms;
+ this._color = new pixi_js$x.Color();
+ this.color = (_a = options.color) != null ? _a : 16777215;
+ }
+ /**
+ * The pixel size used by the filter.
+ * @default 8
+ */
+ get size() {
+ return this.uniforms.uSize;
+ }
+ set size(value) {
+ this.uniforms.uSize = value;
+ }
+ /**
+ * The resulting color of the ascii characters, as a 3 component RGB or numerical hex
+ * @example [1.0, 1.0, 1.0] = 0xffffff
+ * @default 0xffffff
+ */
+ get color() {
+ return this._color.value;
+ }
+ set color(value) {
+ this._color.setValue(value);
+ const [r, g, b] = this._color.toArray();
+ this.uniforms.uColor[0] = r;
+ this.uniforms.uColor[1] = g;
+ this.uniforms.uColor[2] = b;
+ }
+ /**
+ * Determine whether or not to replace the source colors with the provided.
+ */
+ get replaceColor() {
+ return this.uniforms.uReplaceColor > 0.5;
+ }
+ set replaceColor(value) {
+ this.uniforms.uReplaceColor = value ? 1 : 0;
+ }
+ };
+ __publicField$10(_AsciiFilter$1, "DEFAULT_OPTIONS", {
+ size: 8,
+ color: 16777215,
+ replaceColor: false
+ });
+ let AsciiFilter$1 = _AsciiFilter$1;
+ AsciiFilter$2.AsciiFilter = AsciiFilter$1;
+
+ var BevelFilter$2 = {};
+
+ var bevel$3 = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var fragment = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uTransform;\nuniform vec3 uLightColor;\nuniform float uLightAlpha;\nuniform vec3 uShadowColor;\nuniform float uShadowAlpha;\n\nuniform vec4 uInputSize;\n\nvoid main(void) {\n vec2 transform = vec2(1.0 / uInputSize) * vec2(uTransform.x, uTransform.y);\n vec4 color = texture(uTexture, vTextureCoord);\n float light = texture(uTexture, vTextureCoord - transform).a;\n float shadow = texture(uTexture, vTextureCoord + transform).a;\n\n color.rgb = mix(color.rgb, uLightColor, clamp((color.a - light) * uLightAlpha, 0.0, 1.0));\n color.rgb = mix(color.rgb, uShadowColor, clamp((color.a - shadow) * uShadowAlpha, 0.0, 1.0));\n finalColor = vec4(color.rgb * color.a, color.a);\n}\n";
+ exports["default"] = fragment;
+ })(bevel$3);
+
+ var bevel2 = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var source = "struct BevelUniforms {\n uLightColor: vec3,\n uLightAlpha: f32,\n uShadowColor: vec3,\n uShadowAlpha: f32,\n uTransform: vec2,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var bevelUniforms : BevelUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let transform = vec2(1.0 / gfu.uInputSize.xy) * vec2(bevelUniforms.uTransform.x, bevelUniforms.uTransform.y);\n var color: vec4 = textureSample(uTexture, uSampler, uv);\n let lightSample: f32 = textureSample(uTexture, uSampler, uv - transform).a;\n let shadowSample: f32 = textureSample(uTexture, uSampler, uv + transform).a;\n\n let light = vec4(bevelUniforms.uLightColor, bevelUniforms.uLightAlpha);\n let shadow = vec4(bevelUniforms.uShadowColor, bevelUniforms.uShadowAlpha);\n\n color = vec4(mix(color.rgb, light.rgb, clamp((color.a - lightSample) * light.a, 0.0, 1.0)), color.a);\n color = vec4(mix(color.rgb, shadow.rgb, clamp((color.a - shadowSample) * shadow.a, 0.0, 1.0)), color.a);\n \n return vec4(color.rgb * color.a, color.a);\n}";
+ exports["default"] = source;
+ })(bevel2);
+
+ var __defProp$$ = Object.defineProperty;
+ var __getOwnPropSymbols$s = Object.getOwnPropertySymbols;
+ var __hasOwnProp$s = Object.prototype.hasOwnProperty;
+ var __propIsEnum$s = Object.prototype.propertyIsEnumerable;
+ var __defNormalProp$$ = (obj, key, value) => key in obj ? __defProp$$(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+ var __spreadValues$s = (a, b) => {
+ for (var prop in b || (b = {}))
+ if (__hasOwnProp$s.call(b, prop))
+ __defNormalProp$$(a, prop, b[prop]);
+ if (__getOwnPropSymbols$s)
+ for (var prop of __getOwnPropSymbols$s(b)) {
+ if (__propIsEnum$s.call(b, prop))
+ __defNormalProp$$(a, prop, b[prop]);
+ }
+ return a;
+ };
+ Object.defineProperty(BevelFilter$2, "__esModule", { value: true });
+ var pixi_js$w = require$$0__default["default"];
+ var _default$1$t = _default$A;
+ var _default$u = default2;
+ var bevel$1 = bevel$3;
+ var bevel$2 = bevel2;
+ var __defProp2$s = Object.defineProperty;
+ var __defNormalProp2$s = (obj, key, value) => key in obj ? __defProp2$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+ var __publicField$$ = (obj, key, value) => {
+ __defNormalProp2$s(obj, typeof key !== "symbol" ? key + "" : key, value);
+ return value;
+ };
+ const _BevelFilter$1 = class _BevelFilter2 extends pixi_js$w.Filter {
+ constructor(options) {
+ var _a, _b, _c;
+ options = __spreadValues$s(__spreadValues$s({}, _BevelFilter2.DEFAULT_OPTIONS), options);
+ const rotation = ((_a = options.rotation) != null ? _a : 45) * pixi_js$w.DEG_TO_RAD;
+ const gpuProgram = new pixi_js$w.GpuProgram({
+ vertex: {
+ source: _default$u["default"],
+ entryPoint: "mainVertex"
+ },
+ fragment: {
+ source: bevel$2["default"],
+ entryPoint: "mainFragment"
+ }
+ });
+ const glProgram = new pixi_js$w.GlProgram({
+ vertex: _default$1$t["default"],
+ fragment: bevel$1["default"],
+ name: "bevel-filter"
+ });
+ super({
+ gpuProgram,
+ glProgram,
+ resources: {
+ bevelUniforms: {
+ uLightColor: { value: new Float32Array(3), type: "vec3" },
+ uLightAlpha: { value: options.lightAlpha, type: "f32" },
+ uShadowColor: { value: new Float32Array(3), type: "vec3" },
+ uShadowAlpha: { value: options.shadowAlpha, type: "f32" },
+ uTransform: { value: new Float32Array(2), type: "vec2" }
+ }
+ },
+ // Workaround: https://github.com/pixijs/filters/issues/230
+ // applies correctly only if there is at least a single-pixel padding with alpha=0 around an image
+ // To solve this problem, a padding of 1 put on the filter should suffice
+ padding: 1
+ });
+ __publicField$$(this, "uniforms");
+ __publicField$$(this, "_thickness");
+ __publicField$$(this, "_rotation");
+ __publicField$$(this, "_lightColor");
+ __publicField$$(this, "_shadowColor");
+ this.uniforms = this.resources.bevelUniforms.uniforms;
+ this._lightColor = new pixi_js$w.Color();
+ this._shadowColor = new pixi_js$w.Color();
+ this.lightColor = (_b = options.lightColor) != null ? _b : 16777215;
+ this.shadowColor = (_c = options.shadowColor) != null ? _c : 0;
+ Object.assign(this, options, { rotation });
+ }
+ /**
+ * The angle of the light in degrees
+ * @default 45
+ */
+ get rotation() {
+ return this._rotation / pixi_js$w.DEG_TO_RAD;
+ }
+ set rotation(value) {
+ this._rotation = value * pixi_js$w.DEG_TO_RAD;
+ this._updateTransform();
+ }
+ /**
+ * The thickness of the bevel
+ * @default 2
+ */
+ get thickness() {
+ return this._thickness;
+ }
+ set thickness(value) {
+ this._thickness = value;
+ this._updateTransform();
+ }
+ /**
+ * The color value of the left & top bevel.
+ * @example [1.0, 1.0, 1.0] = 0xffffff
+ * @default 0xffffff
+ */
+ get lightColor() {
+ return this._lightColor.value;
+ }
+ set lightColor(value) {
+ this._lightColor.setValue(value);
+ const [r, g, b] = this._lightColor.toArray();
+ this.uniforms.uLightColor[0] = r;
+ this.uniforms.uLightColor[1] = g;
+ this.uniforms.uLightColor[2] = b;
+ }
+ /**
+ * The alpha value of the left & top bevel.
+ * @default 0.7
+ */
+ get lightAlpha() {
+ return this.uniforms.uLightAlpha;
+ }
+ set lightAlpha(value) {
+ this.uniforms.uLightAlpha = value;
+ }
+ /**
+ * The color value of the right & bottom bevel.
+ * @default 0xffffff
+ */
+ get shadowColor() {
+ return this._shadowColor.value;
+ }
+ set shadowColor(value) {
+ this._shadowColor.setValue(value);
+ const [r, g, b] = this._shadowColor.toArray();
+ this.uniforms.uShadowColor[0] = r;
+ this.uniforms.uShadowColor[1] = g;
+ this.uniforms.uShadowColor[2] = b;
+ }
+ /**
+ * The alpha value of the right & bottom bevel.
+ * @default 0.7
+ */
+ get shadowAlpha() {
+ return this.uniforms.uShadowAlpha;
+ }
+ set shadowAlpha(value) {
+ this.uniforms.uShadowAlpha = value;
+ }
+ /**
+ * Update the transform matrix of offset angle.
+ * @private
+ */
+ _updateTransform() {
+ this.uniforms.uTransform[0] = this.thickness * Math.cos(this._rotation);
+ this.uniforms.uTransform[1] = this.thickness * Math.sin(this._rotation);
+ }
+ };
+ __publicField$$(_BevelFilter$1, "DEFAULT_OPTIONS", {
+ rotation: 45,
+ thickness: 2,
+ lightColor: 16777215,
+ lightAlpha: 0.7,
+ shadowColor: 0,
+ shadowAlpha: 0.7
+ });
+ let BevelFilter$1 = _BevelFilter$1;
+ BevelFilter$2.BevelFilter = BevelFilter$1;
+
+ var BloomFilter$2 = {};
+
+ var __defProp$_ = Object.defineProperty;
+ var __defProps$2 = Object.defineProperties;
+ var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
+ var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
+ var __hasOwnProp$r = Object.prototype.hasOwnProperty;
+ var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
+ var __defNormalProp$_ = (obj, key, value) => key in obj ? __defProp$_(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+ var __spreadValues$r = (a, b) => {
+ for (var prop in b || (b = {}))
+ if (__hasOwnProp$r.call(b, prop))
+ __defNormalProp$_(a, prop, b[prop]);
+ if (__getOwnPropSymbols$r)
+ for (var prop of __getOwnPropSymbols$r(b)) {
+ if (__propIsEnum$r.call(b, prop))
+ __defNormalProp$_(a, prop, b[prop]);
+ }
+ return a;
+ };
+ var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
+ Object.defineProperty(BloomFilter$2, "__esModule", { value: true });
+ var pixi_js$v = require$$0__default["default"];
+ var __defProp2$r = Object.defineProperty;
+ var __defNormalProp2$r = (obj, key, value) => key in obj ? __defProp2$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+ var __publicField$_ = (obj, key, value) => {
+ __defNormalProp2$r(obj, typeof key !== "symbol" ? key + "" : key, value);
+ return value;
+ };
+ const _BloomFilter$1 = class _BloomFilter2 extends pixi_js$v.AlphaFilter {
+ constructor(options) {
+ options = __spreadValues$r(__spreadValues$r({}, _BloomFilter2.DEFAULT_OPTIONS), options);
+ super();
+ __publicField$_(this, "_blurXFilter");
+ __publicField$_(this, "_blurYFilter");
+ __publicField$_(this, "_strength");
+ this._strength = { x: 2, y: 2 };
+ if (options.strength) {
+ if (typeof options.strength === "number") {
+ this._strength.x = options.strength;
+ this._strength.y = options.strength;
+ } else {
+ this._strength.x = options.strength.x;
+ this._strength.y = options.strength.y;
+ }
+ }
+ this._blurXFilter = new pixi_js$v.BlurFilterPass(__spreadProps$2(__spreadValues$r({}, options), {
+ horizontal: true,
+ strength: this.strengthX
+ }));
+ this._blurYFilter = new pixi_js$v.BlurFilterPass(__spreadProps$2(__spreadValues$r({}, options), {
+ horizontal: false,
+ strength: this.strengthY
+ }));
+ this._blurYFilter.blendMode = "screen";
+ Object.assign(this, options);
+ }
+ /**
+ * Override existing apply method in `Filter`
+ * @override
+ * @ignore
+ */
+ apply(filterManager, input, output, clear) {
+ const renderTarget = pixi_js$v.TexturePool.getSameSizeTexture(input);
+ filterManager.applyFilter(this, input, output, clear);
+ this._blurXFilter.apply(filterManager, input, renderTarget, true);
+ this._blurYFilter.apply(filterManager, renderTarget, output, false);
+ pixi_js$v.TexturePool.returnTexture(renderTarget);
+ }
+ /**
+ * Sets the strength of both the blurX and blurY properties simultaneously
+ * @default 2
+ */
+ get strength() {
+ return this._strength;
+ }
+ set strength(value) {
+ this._strength = typeof value === "number" ? { x: value, y: value } : value;
+ this._updateStrength();
+ }
+ /**
+ * Sets the strength of the blur on the `x` axis
+ * @default 2
+ */
+ get strengthX() {
+ return this.strength.x;
+ }
+ set strengthX(value) {
+ this.strength.x = value;
+ this._updateStrength();
+ }
+ /**
+ * Sets the strength of the blur on the `y` axis
+ * @default 2
+ */
+ get strengthY() {
+ return this.strength.y;
+ }
+ set strengthY(value) {
+ this.strength.y = value;
+ this._updateStrength();
+ }
+ _updateStrength() {
+ this._blurXFilter.blur = this.strengthX;
+ this._blurYFilter.blur = this.strengthY;
+ }
+ };
+ __publicField$_(_BloomFilter$1, "DEFAULT_OPTIONS", {
+ strength: { x: 2, y: 2 },
+ quality: 4,
+ kernelSize: 5
+ });
+ let BloomFilter$1 = _BloomFilter$1;
+ BloomFilter$2.BloomFilter = BloomFilter$1;
+
+ var BulgePinchFilter$2 = {};
+
+ var bulgePinch2 = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var fragment = "precision highp float;\nin vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec2 uDimensions;\nuniform vec2 uCenter;\nuniform float uRadius;\nuniform float uStrength;\n\nuniform vec4 uInputSize;\nuniform vec4 uInputClamp;\n\nvoid main()\n{\n vec2 coord = vTextureCoord * uInputSize.xy;\n coord -= uCenter * uDimensions.xy;\n float distance = length(coord);\n\n if (distance < uRadius) {\n float percent = distance / uRadius;\n if (uStrength > 0.0) {\n coord *= mix(1.0, smoothstep(0.0, uRadius / distance, percent), uStrength * 0.75);\n } else {\n coord *= mix(1.0, pow(percent, 1.0 + uStrength * 0.75) * uRadius / distance, 1.0 - percent);\n }\n }\n\n coord += uCenter * uDimensions.xy;\n coord /= uInputSize.xy;\n vec2 clampedCoord = clamp(coord, uInputClamp.xy, uInputClamp.zw);\n vec4 color = texture(uTexture, clampedCoord);\n\n if (coord != clampedCoord) {\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n finalColor = color;\n}\n";
+ exports["default"] = fragment;
+ })(bulgePinch2);
+
+ var bulgePinch$3 = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var source = "struct BulgePinchUniforms {\n uDimensions: vec2,\n uCenter: vec2,\n uRadius: f32,\n uStrength: f32,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var bulgePinchUniforms : BulgePinchUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let dimensions: vec2 = bulgePinchUniforms.uDimensions;\n let center: vec2 = bulgePinchUniforms.uCenter;\n let radius: f32 = bulgePinchUniforms.uRadius;\n let strength: f32 = bulgePinchUniforms.uStrength;\n var coord: vec2 = (uv * gfu.uInputSize.xy) - center * dimensions.xy;\n\n let distance: f32 = length(coord);\n\n if (distance < radius) {\n let percent: f32 = distance / radius;\n if (strength > 0.0) {\n coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);\n } else {\n coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);\n }\n }\n coord += (center * dimensions.xy);\n coord /= gfu.uInputSize.xy;\n\n let clampedCoord: vec2 = clamp(coord, gfu.uInputClamp.xy, gfu.uInputClamp.zw);\n var color: vec4 = textureSample(uTexture, uSampler, clampedCoord);\n if (coord.x != clampedCoord.x && coord.y != clampedCoord.y) {\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n return color;\n}\n\nfn compareVec2(x: vec2, y: vec2) -> bool\n{\n if (x.x == y.x && x.y == y.y)\n {\n return true;\n }\n\n return false;\n}";
+ exports["default"] = source;
+ })(bulgePinch$3);
+
+ var __defProp$Z = Object.defineProperty;
+ var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
+ var __hasOwnProp$q = Object.prototype.hasOwnProperty;
+ var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
+ var __defNormalProp$Z = (obj, key, value) => key in obj ? __defProp$Z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+ var __spreadValues$q = (a, b) => {
+ for (var prop in b || (b = {}))
+ if (__hasOwnProp$q.call(b, prop))
+ __defNormalProp$Z(a, prop, b[prop]);
+ if (__getOwnPropSymbols$q)
+ for (var prop of __getOwnPropSymbols$q(b)) {
+ if (__propIsEnum$q.call(b, prop))
+ __defNormalProp$Z(a, prop, b[prop]);
+ }
+ return a;
+ };
+ Object.defineProperty(BulgePinchFilter$2, "__esModule", { value: true });
+ var pixi_js$u = require$$0__default["default"];
+ var _default$1$s = _default$A;
+ var _default$t = default2;
+ var bulgePinch$1 = bulgePinch2;
+ var bulgePinch$2 = bulgePinch$3;
+ var __defProp2$q = Object.defineProperty;
+ var __defNormalProp2$q = (obj, key, value) => key in obj ? __defProp2$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+ var __publicField$Z = (obj, key, value) => {
+ __defNormalProp2$q(obj, typeof key !== "symbol" ? key + "" : key, value);
+ return value;
+ };
+ const _BulgePinchFilter$1 = class _BulgePinchFilter2 extends pixi_js$u.Filter {
+ constructor(options) {
+ options = __spreadValues$q(__spreadValues$q({}, _BulgePinchFilter2.DEFAULT_OPTIONS), options);
+ const gpuProgram = new pixi_js$u.GpuProgram({
+ vertex: {
+ source: _default$t["default"],
+ entryPoint: "mainVertex"
+ },
+ fragment: {
+ source: bulgePinch$2["default"],
+ entryPoint: "mainFragment"
+ }
+ });
+ const glProgram = new pixi_js$u.GlProgram({
+ vertex: _default$1$s["default"],
+ fragment: bulgePinch$1["default"],
+ name: "bulge-pinch-filter"
+ });
+ super({
+ gpuProgram,
+ glProgram,
+ resources: {
+ bulgePinchUniforms: {
+ uDimensions: { value: [0, 0], type: "vec2" },
+ uCenter: { value: options.center, type: "vec2" },
+ uRadius: { value: options.radius, type: "f32" },
+ uStrength: { value: options.strength, type: "f32" }
+ }
+ }
+ });
+ __publicField$Z(this, "uniforms");
+ this.uniforms = this.resources.bulgePinchUniforms.uniforms;
+ Object.assign(this, options);
+ }
+ /**
+ * Override existing apply method in `Filter`
+ * @override
+ * @ignore
+ */
+ apply(filterManager, input, output, clearMode) {
+ this.uniforms.uDimensions[0] = input.frame.width;
+ this.uniforms.uDimensions[1] = input.frame.height;
+ filterManager.applyFilter(this, input, output, clearMode);
+ }
+ /**
+ * Sets the center of the effect in normalized screen coords.
+ * { x: 0, y: 0 } means top-left and { x: 1, y: 1 } mean bottom-right
+ * @default {x:0.5,y:0.5}
+ */
+ get center() {
+ return this.uniforms.uCenter;
+ }
+ set center(value) {
+ this.uniforms.uCenter = value;
+ }
+ /**
+ * Sets the center of the effect in normalized screen coords on the `x` axis
+ * @default 0
+ */
+ get centerX() {
+ return this.uniforms.uCenter.x;
+ }
+ set centerX(value) {
+ this.uniforms.uCenter.x = value;
+ }
+ /**
+ * Sets the center of the effect in normalized screen coords on the `y` axis
+ * @default 0
+ */
+ get centerY() {
+ return this.uniforms.uCenter.y;
+ }
+ set centerY(value) {
+ this.uniforms.uCenter.y = value;
+ }
+ /**
+ * The radius of the circle of effect
+ * @default 100
+ */
+ get radius() {
+ return this.uniforms.uRadius;
+ }
+ set radius(value) {
+ this.uniforms.uRadius = value;
+ }
+ /**
+ * A value between -1 and 1 (-1 is strong pinch, 0 is no effect, 1 is strong bulge)
+ * @default 1
+ */
+ get strength() {
+ return this.uniforms.uStrength;
+ }
+ set strength(value) {
+ this.uniforms.uStrength = value;
+ }
+ };
+ __publicField$Z(_BulgePinchFilter$1, "DEFAULT_OPTIONS", {
+ center: { x: 0.5, y: 0.5 },
+ radius: 100,
+ strength: 1
+ });
+ let BulgePinchFilter$1 = _BulgePinchFilter$1;
+ BulgePinchFilter$2.BulgePinchFilter = BulgePinchFilter$1;
+
+ var ColorGradientFilter$3 = {};
+
+ var colorGradient$4 = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var fragment = "precision highp float;\nin vec2 vTextureCoord;\nin vec2 vFilterCoord;\nout vec4 finalColor;\n\nconst int TYPE_LINEAR = 0;\nconst int TYPE_RADIAL = 1;\nconst int TYPE_CONIC = 2;\nconst int MAX_STOPS = 32;\n\nuniform sampler2D uTexture;\nuniform vec4 uOptions;\nuniform vec2 uCounts;\nuniform vec3 uColors[MAX_STOPS];\nuniform vec4 uStops[MAX_STOPS];\n\nconst float PI = 3.1415926538;\nconst float PI_2 = PI*2.;\n\nstruct ColorStop {\n float offset;\n vec3 color;\n float alpha;\n};\n\nmat2 rotate2d(float angle){\n return mat2(cos(angle), -sin(angle),\n sin(angle), cos(angle));\n}\n\nfloat projectLinearPosition(vec2 pos, float angle){\n vec2 center = vec2(0.5);\n vec2 result = pos - center;\n result = rotate2d(angle) * result;\n result = result + center;\n return clamp(result.x, 0., 1.);\n}\n\nfloat projectRadialPosition(vec2 pos) {\n float r = distance(pos, vec2(0.5));\n return clamp(2.*r, 0., 1.);\n}\n\nfloat projectAnglePosition(vec2 pos, float angle) {\n vec2 center = pos - vec2(0.5);\n float polarAngle=atan(-center.y, center.x);\n return mod(polarAngle + angle, PI_2) / PI_2;\n}\n\nfloat projectPosition(vec2 pos, int type, float angle) {\n if (type == TYPE_LINEAR) {\n return projectLinearPosition(pos, angle);\n } else if (type == TYPE_RADIAL) {\n return projectRadialPosition(pos);\n } else if (type == TYPE_CONIC) {\n return projectAnglePosition(pos, angle);\n }\n\n return pos.y;\n}\n\nvoid main(void) {\n int uType = int(uOptions[0]);\n float uAngle = uOptions[1];\n float uAlpha = uOptions[2];\n float uReplace = uOptions[3];\n\n int uNumStops = int(uCounts[0]);\n float uMaxColors = uCounts[1];\n\n // current/original color\n vec4 currentColor = texture(uTexture, vTextureCoord);\n\n // skip calculations if gradient alpha is 0\n if (0.0 == uAlpha) {\n finalColor = currentColor;\n return;\n }\n\n // project position\n float y = projectPosition(vFilterCoord, int(uType), radians(uAngle));\n\n // check gradient bounds\n float offsetMin = uStops[0][0];\n float offsetMax = 0.0;\n\n int numStops = int(uNumStops);\n\n for (int i = 0; i < MAX_STOPS; i++) {\n if (i == numStops-1){ // last index\n offsetMax = uStops[i][0];\n }\n }\n\n if (y < offsetMin || y > offsetMax) {\n finalColor = currentColor;\n return;\n }\n\n // limit colors\n if (uMaxColors > 0.) {\n float stepSize = 1./uMaxColors;\n float stepNumber = float(floor(y/stepSize));\n y = stepSize * (stepNumber + 0.5);// offset by 0.5 to use color from middle of segment\n }\n\n // find color stops\n ColorStop from;\n ColorStop to;\n\n for (int i = 0; i < MAX_STOPS; i++) {\n if (y >= uStops[i][0]) {\n from = ColorStop(uStops[i][0], uColors[i], uStops[i][1]);\n to = ColorStop(uStops[i+1][0], uColors[i+1], uStops[i+1][1]);\n }\n\n if (i == numStops-1){ // last index\n break;\n }\n }\n\n // mix colors from stops\n vec4 colorFrom = vec4(from.color * from.alpha, from.alpha);\n vec4 colorTo = vec4(to.color * to.alpha, to.alpha);\n\n float segmentHeight = to.offset - from.offset;\n float relativePos = y - from.offset;// position from 0 to [segmentHeight]\n float relativePercent = relativePos / segmentHeight;// position in percent between [from.offset] and [to.offset].\n\n float gradientAlpha = uAlpha * currentColor.a;\n vec4 gradientColor = mix(colorFrom, colorTo, relativePercent) * gradientAlpha;\n\n if (uReplace < 0.5) {\n // mix resulting color with current color\n finalColor = gradientColor + currentColor*(1.-gradientColor.a);\n } else {\n // replace with gradient color\n finalColor = gradientColor;\n }\n}\n";
+ exports["default"] = fragment;
+ })(colorGradient$4);
+
+ var colorGradient2 = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var vertex = "in vec2 aPosition;\nout vec2 vTextureCoord;\nout vec2 vFilterCoord;\n\nuniform vec4 uInputSize;\nuniform vec4 uOutputFrame;\nuniform vec4 uOutputTexture;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n \n position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aPosition * (uOutputFrame.zw * uInputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n vFilterCoord = vTextureCoord * uInputSize.xy / uOutputFrame.zw;\n}\n";
+ exports["default"] = vertex;
+ })(colorGradient2);
+
+ var colorGradient3 = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var source = "struct BaseUniforms {\n uOptions: vec4,\n uCounts: vec2,\n};\n\nstruct StopsUniforms {\n uColors: array, MAX_STOPS>,\n uStops: array, MAX_STOPS>,\n};\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4,\n uInputPixel:vec4,\n uInputClamp:vec4,\n uOutputFrame:vec4,\n uGlobalFrame:vec4,\n uOutputTexture:vec4,\n};\n\n@group(0) @binding(0) var gfu: GlobalFilterUniforms;\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var baseUniforms : BaseUniforms;\n@group(1) @binding(1) var stopsUniforms : StopsUniforms;\n\nstruct VSOutput {\n @builtin(position) position: vec4,\n @location(0) uv : vec2,\n @location(1) coord : vec2\n};\n\nfn filterVertexPosition(aPosition:vec2) -> vec4\n{\n var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n\n position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nfn filterTextureCoord( aPosition:vec2 ) -> vec2\n{\n return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n}\n\nfn filterCoord( vTextureCoord:vec2 ) -> vec2\n{\n return vTextureCoord * gfu.uInputSize.xy / gfu.uOutputFrame.zw;\n}\n\nfn globalTextureCoord( aPosition:vec2 ) -> vec2\n{\n return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); \n}\n\nfn getSize() -> vec2\n{\n return gfu.uGlobalFrame.zw;\n}\n \n@vertex\nfn mainVertex(\n @location(0) aPosition : vec2, \n) -> VSOutput {\n let vTextureCoord: vec2 = filterTextureCoord(aPosition);\n return VSOutput(\n filterVertexPosition(aPosition),\n vTextureCoord,\n filterCoord(vTextureCoord),\n );\n}\n\nstruct ColorStop {\n offset: f32,\n color: vec3,\n alpha: f32,\n};\n\nfn rotate2d(angle: f32) -> mat2x2{\n return mat2x2(cos(angle), -sin(angle),\n sin(angle), cos(angle));\n}\n\nfn projectLinearPosition(pos: vec2, angle: f32) -> f32 {\n var center: vec2 = vec2(0.5);\n var result: vec2 = pos - center;\n result = rotate2d(angle) * result;\n result = result + center;\n return clamp(result.x, 0.0, 1.0);\n}\n\nfn projectRadialPosition(pos: vec2) -> f32 {\n var r: f32 = distance(pos, vec2(0.5));\n return clamp(2.0 * r, 0.0, 1.0);\n}\n\nfn projectAnglePosition(pos: vec2, angle: f32) -> f32 {\n var center: vec2 = pos - vec2(0.5, 0.5);\n var polarAngle: f32 = atan2(-center.y, center.x);\n return ((polarAngle + angle) % PI_2) / PI_2;\n}\n\nfn projectPosition(pos: vec2, gradientType: i32, angle: f32) -> f32 {\n if (gradientType == TYPE_LINEAR) {\n return projectLinearPosition(pos, angle);\n } else if (gradientType == TYPE_RADIAL) {\n return projectRadialPosition(pos);\n } else if (gradientType == TYPE_CONIC) {\n return projectAnglePosition(pos, angle);\n }\n\n return pos.y;\n}\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2,\n @location(1) coord : vec2\n) -> @location(0) vec4 {\n let uType: i32 = i32(baseUniforms.uOptions[0]);\n let uAngle: f32 = baseUniforms.uOptions[1];\n let uAlpha: f32 = baseUniforms.uOptions[2];\n let uReplace: f32 = baseUniforms.uOptions[3];\n\n let uNumStops: i32 = i32(baseUniforms.uCounts[0]);\n let uMaxColors: f32 = baseUniforms.uCounts[1];\n\n // current/original color\n var currentColor: vec4 = textureSample(uTexture, uSampler, uv);\n\n // skip calculations if gradient alpha is 0\n if (uAlpha == 0.0) { return currentColor; }\n\n // project position\n var y: f32 = projectPosition(coord, uType, radians(uAngle));\n\n // check gradient bounds\n var offsetMin: f32 = stopsUniforms.uStops[0][0];\n var offsetMax: f32 = 0.0;\n\n let numStops: i32 = uNumStops;\n\n for (var i: i32 = 0; i < MAX_STOPS; i = i + 1) {\n if (i == numStops - 1) { // last index\n offsetMax = stopsUniforms.uStops[i][0];\n }\n }\n\n if (y < offsetMin || y > offsetMax) { return currentColor; }\n\n // limit colors\n if (uMaxColors > 0.0) {\n var stepSize: f32 = 1.0 / uMaxColors;\n var stepNumber: f32 = floor(y / stepSize);\n y = stepSize * (stepNumber + 0.5); // offset by 0.5 to use color from middle of segment\n }\n\n // find color stops\n var stopFrom: ColorStop;\n var stopTo: ColorStop;\n\n for (var i: i32 = 0; i < MAX_STOPS; i = i + 1) {\n if (y >= stopsUniforms.uStops[i][0]) {\n stopFrom = ColorStop(stopsUniforms.uStops[i][0], stopsUniforms.uColors[i], stopsUniforms.uStops[i][1]);\n stopTo = ColorStop(stopsUniforms.uStops[i + 1][0], stopsUniforms.uColors[i + 1], stopsUniforms.uStops[i + 1][1]);\n }\n\n if (i == numStops - 1) { // last index\n break;\n }\n }\n\n // mix colors from stops\n var colorFrom: vec4 = vec4(stopFrom.color * stopFrom.alpha, stopFrom.alpha);\n var colorTo: vec4 = vec4(stopTo.color * stopTo.alpha, stopTo.alpha);\n\n var segmentHeight: f32 = stopTo.offset - stopFrom.offset;\n var relativePos: f32 = y - stopFrom.offset; // position from 0 to [segmentHeight]\n var relativePercent: f32 = relativePos / segmentHeight; // position in percent between [from.offset] and [to.offset].\n\n var gradientAlpha: f32 = uAlpha * currentColor.a;\n var gradientColor: vec4 = mix(colorFrom, colorTo, relativePercent) * gradientAlpha;\n\n if (uReplace < 0.5) {\n // mix resulting color with current color\n return gradientColor + currentColor * (1.0 - gradientColor.a);\n } else {\n // replace with gradient color\n return gradientColor;\n }\n}\n\nconst PI: f32 = 3.14159265358979323846264;\nconst PI_2: f32 = PI * 2.0;\n\nconst TYPE_LINEAR: i32 = 0;\nconst TYPE_RADIAL: i32 = 1;\nconst TYPE_CONIC: i32 = 2;\nconst MAX_STOPS: i32 = 32;";
+ exports["default"] = source;
+ })(colorGradient3);
+
+ var CssGradientParser$2 = {};
+
+ var node$1 = {};
+
+ Object.defineProperty(node$1, "__esModule", { value: true });
+ var GradientParser$1 = GradientParser$1 || {};
+ GradientParser$1.stringify = /* @__PURE__ */ function() {
+ var visitor = {
+ "visit_linear-gradient": function(node2) {
+ return visitor.visit_gradient(node2);
+ },
+ "visit_repeating-linear-gradient": function(node2) {
+ return visitor.visit_gradient(node2);
+ },
+ "visit_radial-gradient": function(node2) {
+ return visitor.visit_gradient(node2);
+ },
+ "visit_repeating-radial-gradient": function(node2) {
+ return visitor.visit_gradient(node2);
+ },
+ "visit_gradient": function(node2) {
+ var orientation = visitor.visit(node2.orientation);
+ if (orientation) {
+ orientation += ", ";
+ }
+ return node2.type + "(" + orientation + visitor.visit(node2.colorStops) + ")";
+ },
+ "visit_shape": function(node2) {
+ var result = node2.value, at = visitor.visit(node2.at), style = visitor.visit(node2.style);
+ if (style) {
+ result += " " + style;
+ }
+ if (at) {
+ result += " at " + at;
+ }
+ return result;
+ },
+ "visit_default-radial": function(node2) {
+ var result = "", at = visitor.visit(node2.at);
+ if (at) {
+ result += at;
+ }
+ return result;
+ },
+ "visit_extent-keyword": function(node2) {
+ var result = node2.value, at = visitor.visit(node2.at);
+ if (at) {
+ result += " at " + at;
+ }
+ return result;
+ },
+ "visit_position-keyword": function(node2) {
+ return node2.value;
+ },
+ "visit_position": function(node2) {
+ return visitor.visit(node2.value.x) + " " + visitor.visit(node2.value.y);
+ },
+ "visit_%": function(node2) {
+ return node2.value + "%";
+ },
+ "visit_em": function(node2) {
+ return node2.value + "em";
+ },
+ "visit_px": function(node2) {
+ return node2.value + "px";
+ },
+ "visit_literal": function(node2) {
+ return visitor.visit_color(node2.value, node2);
+ },
+ "visit_hex": function(node2) {
+ return visitor.visit_color("#" + node2.value, node2);
+ },
+ "visit_rgb": function(node2) {
+ return visitor.visit_color("rgb(" + node2.value.join(", ") + ")", node2);
+ },
+ "visit_rgba": function(node2) {
+ return visitor.visit_color("rgba(" + node2.value.join(", ") + ")", node2);
+ },
+ "visit_color": function(resultColor, node2) {
+ var result = resultColor, length = visitor.visit(node2.length);
+ if (length) {
+ result += " " + length;
+ }
+ return result;
+ },
+ "visit_angular": function(node2) {
+ return node2.value + "deg";
+ },
+ "visit_directional": function(node2) {
+ return "to " + node2.value;
+ },
+ "visit_array": function(elements) {
+ var result = "", size = elements.length;
+ elements.forEach(function(element, i) {
+ result += visitor.visit(element);
+ if (i < size - 1) {
+ result += ", ";
+ }
+ });
+ return result;
+ },
+ "visit": function(element) {
+ if (!element) {
+ return "";
+ }
+ var result = "";
+ if (element instanceof Array) {
+ return visitor.visit_array(element, result);
+ } else if (element.type) {
+ var nodeVisitor = visitor["visit_" + element.type];
+ if (nodeVisitor) {
+ return nodeVisitor(element);
+ } else {
+ throw Error("Missing visitor visit_" + element.type);
+ }
+ } else {
+ throw Error("Invalid node.");
+ }
+ }
+ };
+ return function(root) {
+ return visitor.visit(root);
+ };
+ }();
+ var GradientParser$1 = GradientParser$1 || {};
+ GradientParser$1.parse = /* @__PURE__ */ function() {
+ var tokens = {
+ linearGradient: /^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,
+ repeatingLinearGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,
+ radialGradient: /^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,
+ repeatingRadialGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,
+ sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,
+ extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
+ positionKeywords: /^(left|center|right|top|bottom)/i,
+ pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,
+ percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,
+ emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,
+ angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
+ startCall: /^\(/,
+ endCall: /^\)/,
+ comma: /^,/,
+ hexColor: /^\#([0-9a-fA-F]+)/,
+ literalColor: /^([a-zA-Z]+)/,
+ rgbColor: /^rgb/i,
+ rgbaColor: /^rgba/i,
+ number: /^(([0-9]*\.[0-9]+)|([0-9]+\.?))/
+ };
+ var input = "";
+ function error(msg) {
+ var err = new Error(input + ": " + msg);
+ err.source = input;
+ throw err;
+ }
+ function getAST() {
+ var ast = matchListDefinitions();
+ if (input.length > 0) {
+ error("Invalid input not EOF");
+ }
+ return ast;
+ }
+ function matchListDefinitions() {
+ return matchListing(matchDefinition);
+ }
+ function matchDefinition() {
+ return matchGradient(
+ "linear-gradient",
+ tokens.linearGradient,
+ matchLinearOrientation
+ ) || matchGradient(
+ "repeating-linear-gradient",
+ tokens.repeatingLinearGradient,
+ matchLinearOrientation
+ ) || matchGradient(
+ "radial-gradient",
+ tokens.radialGradient,
+ matchListRadialOrientations
+ ) || matchGradient(
+ "repeating-radial-gradient",
+ tokens.repeatingRadialGradient,
+ matchListRadialOrientations
+ );
+ }
+ function matchGradient(gradientType, pattern, orientationMatcher) {
+ return matchCall(pattern, function(captures) {
+ var orientation = orientationMatcher();
+ if (orientation) {
+ if (!scan(tokens.comma)) {
+ error("Missing comma before color stops");
+ }
+ }
+ return {
+ type: gradientType,
+ orientation,
+ colorStops: matchListing(matchColorStop)
+ };
+ });
+ }
+ function matchCall(pattern, callback) {
+ var captures = scan(pattern);
+ if (captures) {
+ if (!scan(tokens.startCall)) {
+ error("Missing (");
+ }
+ var result = callback(captures);
+ if (!scan(tokens.endCall)) {
+ error("Missing )");
+ }
+ return result;
+ }
+ }
+ function matchLinearOrientation() {
+ return matchSideOrCorner() || matchAngle();
+ }
+ function matchSideOrCorner() {
+ return match("directional", tokens.sideOrCorner, 1);
+ }
+ function matchAngle() {
+ return match("angular", tokens.angleValue, 1);
+ }
+ function matchListRadialOrientations() {
+ var radialOrientations, radialOrientation = matchRadialOrientation(), lookaheadCache;
+ if (radialOrientation) {
+ radialOrientations = [];
+ radialOrientations.push(radialOrientation);
+ lookaheadCache = input;
+ if (scan(tokens.comma)) {
+ radialOrientation = matchRadialOrientation();
+ if (radialOrientation) {
+ radialOrientations.push(radialOrientation);
+ } else {
+ input = lookaheadCache;
+ }
+ }
+ }
+ return radialOrientations;
+ }
+ function matchRadialOrientation() {
+ var radialType = matchCircle() || matchEllipse();
+ if (radialType) {
+ radialType.at = matchAtPosition();
+ } else {
+ var extent = matchExtentKeyword();
+ if (extent) {
+ radialType = extent;
+ var positionAt = matchAtPosition();
+ if (positionAt) {
+ radialType.at = positionAt;
+ }
+ } else {
+ var defaultPosition = matchPositioning();
+ if (defaultPosition) {
+ radialType = {
+ type: "default-radial",
+ at: defaultPosition
+ };
+ }
+ }
+ }
+ return radialType;
+ }
+ function matchCircle() {
+ var circle = match("shape", /^(circle)/i, 0);
+ if (circle) {
+ circle.style = matchLength() || matchExtentKeyword();
+ }
+ return circle;
+ }
+ function matchEllipse() {
+ var ellipse = match("shape", /^(ellipse)/i, 0);
+ if (ellipse) {
+ ellipse.style = matchDistance() || matchExtentKeyword();
+ }
+ return ellipse;
+ }
+ function matchExtentKeyword() {
+ return match("extent-keyword", tokens.extentKeywords, 1);
+ }
+ function matchAtPosition() {
+ if (match("position", /^at/, 0)) {
+ var positioning = matchPositioning();
+ if (!positioning) {
+ error("Missing positioning value");
+ }
+ return positioning;
+ }
+ }
+ function matchPositioning() {
+ var location = matchCoordinates();
+ if (location.x || location.y) {
+ return {
+ type: "position",
+ value: location
+ };
+ }
+ }
+ function matchCoordinates() {
+ return {
+ x: matchDistance(),
+ y: matchDistance()
+ };
+ }
+ function matchListing(matcher) {
+ var captures = matcher(), result = [];
+ if (captures) {
+ result.push(captures);
+ while (scan(tokens.comma)) {
+ captures = matcher();
+ if (captures) {
+ result.push(captures);
+ } else {
+ error("One extra comma");
+ }
+ }
+ }
+ return result;
+ }
+ function matchColorStop() {
+ var color = matchColor();
+ if (!color) {
+ error("Expected color definition");
+ }
+ color.length = matchDistance();
+ return color;
+ }
+ function matchColor() {
+ return matchHexColor() || matchRGBAColor() || matchRGBColor() || matchLiteralColor();
+ }
+ function matchLiteralColor() {
+ return match("literal", tokens.literalColor, 0);
+ }
+ function matchHexColor() {
+ return match("hex", tokens.hexColor, 1);
+ }
+ function matchRGBColor() {
+ return matchCall(tokens.rgbColor, function() {
+ return {
+ type: "rgb",
+ value: matchListing(matchNumber)
+ };
+ });
+ }
+ function matchRGBAColor() {
+ return matchCall(tokens.rgbaColor, function() {
+ return {
+ type: "rgba",
+ value: matchListing(matchNumber)
+ };
+ });
+ }
+ function matchNumber() {
+ return scan(tokens.number)[1];
+ }
+ function matchDistance() {
+ return match("%", tokens.percentageValue, 1) || matchPositionKeyword() || matchLength();
+ }
+ function matchPositionKeyword() {
+ return match("position-keyword", tokens.positionKeywords, 1);
+ }
+ function matchLength() {
+ return match("px", tokens.pixelValue, 1) || match("em", tokens.emValue, 1);
+ }
+ function match(type, pattern, captureIndex) {
+ var captures = scan(pattern);
+ if (captures) {
+ return {
+ type,
+ value: captures[captureIndex]
+ };
+ }
+ }
+ function scan(regexp) {
+ var captures, blankCaptures;
+ blankCaptures = /^[\n\r\t\s]+/.exec(input);
+ if (blankCaptures) {
+ consume(blankCaptures[0].length);
+ }
+ captures = regexp.exec(input);
+ if (captures) {
+ consume(captures[0].length);
+ }
+ return captures;
+ }
+ function consume(size) {
+ input = input.substr(size);
+ }
+ return function(code) {
+ input = code.toString();
+ return getAST();
+ };
+ }();
+ var parse$1 = GradientParser$1.parse;
+ GradientParser$1.stringify;
+ node$1.parse = parse$1;
+
+ Object.defineProperty(CssGradientParser$2, "__esModule", { value: true });
+ var node = node$1;
+ var pixi_js$t = require$$0__default["default"];
+ function parseCssGradient$2(cssGradient) {
+ const cssGradientNodes = node.parse(trimCssGradient$2(cssGradient));
+ if (cssGradientNodes.length === 0) {
+ throw new Error("Invalid CSS gradient.");
+ } else if (cssGradientNodes.length !== 1) {
+ throw new Error("Unsupported CSS gradient (multiple gradients is not supported).");
+ }
+ const cssGradientNode = cssGradientNodes[0];
+ const type = typeFromCssType$2(cssGradientNode.type);
+ const stops = stopsFromCssStops$2(cssGradientNode.colorStops);
+ const angle = angleFromCssOrientation$2(cssGradientNode.orientation);
+ return {
+ type,
+ stops,
+ angle
+ };
+ }
+ function typeFromCssType$2(type) {
+ const supportedTypes = {
+ "linear-gradient": 0,
+ "radial-gradient": 1
+ };
+ if (!(type in supportedTypes)) {
+ throw new Error(`Unsupported gradient type "${type}"`);
+ }
+ return supportedTypes[type];
+ }
+ function stopsFromCssStops$2(stops) {
+ const offsets = offsetsFromCssColorStops$2(stops);
+ const result = [];
+ const color = new pixi_js$t.Color();
+ for (let i = 0; i < stops.length; i++) {
+ const colorString = colorAsStringFromCssStop$2(stops[i]);
+ const rgbaColor = color.setValue(colorString).toArray();
+ result.push({
+ offset: offsets[i],
+ color: rgbaColor.slice(0, 3),
+ alpha: rgbaColor[3]
+ });
+ }
+ return result;
+ }
+ function colorAsStringFromCssStop$2(stop) {
+ switch (stop.type) {
+ case "hex":
+ return `#${stop.value}`;
+ case "literal":
+ return stop.value;
+ default:
+ return `${stop.type}(${stop.value.join(",")})`;
+ }
+ }
+ function offsetsFromCssColorStops$2(stops) {
+ const offsets = [];
+ const dynamicOffset = -1;
+ for (let i = 0; i < stops.length; i++) {
+ const cssStop = stops[i];
+ let stopOffset = dynamicOffset;
+ if (cssStop.type === "literal") {
+ if (cssStop.length && "type" in cssStop.length && cssStop.length.type === "%" && "value" in cssStop.length) {
+ stopOffset = parseFloat(cssStop.length.value) / 100;
+ }
+ }
+ offsets.push(stopOffset);
+ }
+ const findNextFixedStop = (fromIndex) => {
+ for (let k = fromIndex; k < offsets.length; k++) {
+ if (offsets[k] !== dynamicOffset) {
+ return {
+ indexDelta: k - fromIndex,
+ offset: offsets[k]
+ };
+ }
+ }
+ return {
+ indexDelta: offsets.length - 1 - fromIndex,
+ offset: 1
+ };
+ };
+ let prevFixedOffset = 0;
+ for (let i = 0; i < offsets.length; i++) {
+ const offset = offsets[i];
+ if (offset !== dynamicOffset) {
+ prevFixedOffset = offset;
+ } else if (i === 0) {
+ offsets[i] = 0;
+ } else if (i + 1 === offsets.length) {
+ offsets[i] = 1;
+ } else {
+ const nextFixed = findNextFixedStop(i);
+ const offsetDelta = nextFixed.offset - prevFixedOffset;
+ const stepSize = offsetDelta / (1 + nextFixed.indexDelta);
+ for (let s = 0; s <= nextFixed.indexDelta; s++) {
+ offsets[i + s] = prevFixedOffset + (s + 1) * stepSize;
+ }
+ i += nextFixed.indexDelta;
+ prevFixedOffset = offsets[i];
+ }
+ }
+ return offsets.map(fixFloatRounding$1);
+ }
+ function fixFloatRounding$1(value) {
+ const maxLength = 6;
+ if (value.toString().length > maxLength) {
+ return parseFloat(value.toString().substring(0, maxLength));
+ }
+ return value;
+ }
+ function angleFromCssOrientation$2(orientation) {
+ if (typeof orientation === "undefined") {
+ return 0;
+ }
+ if ("type" in orientation && "value" in orientation) {
+ switch (orientation.type) {
+ case "angular":
+ return parseFloat(orientation.value);
+ case "directional":
+ return angleFromDirectionalValue$2(orientation.value);
+ }
+ }
+ return 0;
+ }
+ function angleFromDirectionalValue$2(value) {
+ const supportedValues = {
+ left: 270,
+ top: 0,
+ bottom: 180,
+ right: 90,
+ "left top": 315,
+ "top left": 315,
+ "left bottom": 225,
+ "bottom left": 225,
+ "right top": 45,
+ "top right": 45,
+ "right bottom": 135,
+ "bottom right": 135
+ };
+ if (!(value in supportedValues)) {
+ throw new Error(`Unsupported directional value "${value}"`);
+ }
+ return supportedValues[value];
+ }
+ function trimCssGradient$2(value) {
+ let value_ = value.replace(/\s{2,}/gu, " ");
+ value_ = value_.replace(/;/g, "");
+ value_ = value_.replace(/ ,/g, ",");
+ value_ = value_.replace(/\( /g, "(");
+ value_ = value_.replace(/ \)/g, ")");
+ return value_.trim();
+ }
+ CssGradientParser$2.angleFromCssOrientation = angleFromCssOrientation$2;
+ CssGradientParser$2.angleFromDirectionalValue = angleFromDirectionalValue$2;
+ CssGradientParser$2.colorAsStringFromCssStop = colorAsStringFromCssStop$2;
+ CssGradientParser$2.offsetsFromCssColorStops = offsetsFromCssColorStops$2;
+ CssGradientParser$2.parseCssGradient = parseCssGradient$2;
+ CssGradientParser$2.stopsFromCssStops = stopsFromCssStops$2;
+ CssGradientParser$2.trimCssGradient = trimCssGradient$2;
+ CssGradientParser$2.typeFromCssType = typeFromCssType$2;
+
+ var __defProp$Y = Object.defineProperty;
+ var __defProps$1 = Object.defineProperties;
+ var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
+ var __getOwnPropSymbols$p = Object.getOwnPropertySymbols;
+ var __hasOwnProp$p = Object.prototype.hasOwnProperty;
+ var __propIsEnum$p = Object.prototype.propertyIsEnumerable;
+ var __defNormalProp$Y = (obj, key, value) => key in obj ? __defProp$Y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+ var __spreadValues$p = (a, b) => {
+ for (var prop in b || (b = {}))
+ if (__hasOwnProp$p.call(b, prop))
+ __defNormalProp$Y(a, prop, b[prop]);
+ if (__getOwnPropSymbols$p)
+ for (var prop of __getOwnPropSymbols$p(b)) {
+ if (__propIsEnum$p.call(b, prop))
+ __defNormalProp$Y(a, prop, b[prop]);
+ }
+ return a;
+ };
+ var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
+ Object.defineProperty(ColorGradientFilter$3, "__esModule", { value: true });
+ var pixi_js$s = require$$0__default["default"];
+ var colorGradient$2 = colorGradient$4;
+ var colorGradient$1 = colorGradient2;
+ var colorGradient$3 = colorGradient3;
+ var CssGradientParser$1 = CssGradientParser$2;
+ var __defProp2$p = Object.defineProperty;
+ var __defNormalProp2$p = (obj, key, value) => key in obj ? __defProp2$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+ var __publicField$Y = (obj, key, value) => {
+ __defNormalProp2$p(obj, typeof key !== "symbol" ? key + "" : key, value);
+ return value;
+ };
+ const ANGLE_OFFSET$1 = 90;
+ function sortColorStops$1(stops) {
+ return [...stops].sort((a, b) => a.offset - b.offset);
+ }
+ const _ColorGradientFilter$1 = class _ColorGradientFilter2 extends pixi_js$s.Filter {
+ /**
+ * @param {DefaultOptions | CssOptions} [options]
+ * @param {number} [options.alpha=1.0] - Alpha value
+ * @param {number} [options.maxColors=0] - Maximum number of colors to render (0 = disabled)
+ */
+ constructor(options) {
+ var _a, _b, _c;
+ if (options && "css" in options) {
+ options = __spreadProps$1(__spreadValues$p({}, CssGradientParser$1.parseCssGradient(options.css || "")), {
+ alpha: (_a = options.alpha) != null ? _a : _ColorGradientFilter2.defaults.alpha,
+ maxColors: (_b = options.maxColors) != null ? _b : _ColorGradientFilter2.defaults.maxColors
+ });
+ } else {
+ options = __spreadValues$p(__spreadValues$p({}, _ColorGradientFilter2.defaults), options);
+ }
+ if (!options.stops || options.stops.length < 2) {
+ throw new Error("ColorGradientFilter requires at least 2 color stops.");
+ }
+ const gpuProgram = new pixi_js$s.GpuProgram({
+ vertex: {
+ source: colorGradient$3["default"],
+ entryPoint: "mainVertex"
+ },
+ fragment: {
+ source: colorGradient$3["default"],
+ entryPoint: "mainFragment"
+ }
+ });
+ const glProgram = new pixi_js$s.GlProgram({
+ vertex: colorGradient$1["default"],
+ fragment: colorGradient$2["default"],
+ name: "color-gradient-filter"
+ });
+ const maxStops = 32;
+ super({
+ gpuProgram,
+ glProgram,
+ resources: {
+ baseUniforms: {
+ uOptions: {
+ value: [
+ // Gradient Type
+ options.type,
+ // Gradient Angle
+ (_c = options.angle) != null ? _c : ANGLE_OFFSET$1,
+ // Master Alpha
+ options.alpha,
+ // Replace Base Color
+ options.replace ? 1 : 0
+ ],
+ type: "vec4"
+ },
+ uCounts: {
+ value: [
+ // Number of Stops
+ options.stops.length,
+ // Max Gradient Colors
+ options.maxColors
+ ],
+ type: "vec2"
+ }
+ },
+ stopsUniforms: {
+ uColors: { value: new Float32Array(maxStops * 3), type: "vec3", size: maxStops },
+ // We only need vec2, but we need to pad to eliminate the WGSL warning, TODO: @Mat ?
+ uStops: { value: new Float32Array(maxStops * 4), type: "vec4", size: maxStops }
+ }
+ }
+ });
+ __publicField$Y(this, "baseUniforms");
+ __publicField$Y(this, "stopsUniforms");
+ __publicField$Y(this, "_stops", []);
+ this.baseUniforms = this.resources.baseUniforms.uniforms;
+ this.stopsUniforms = this.resources.stopsUniforms.uniforms;
+ Object.assign(this, options);
+ }
+ get stops() {
+ return this._stops;
+ }
+ set stops(stops) {
+ const sortedStops = sortColorStops$1(stops);
+ const color = new pixi_js$s.Color();
+ let r;
+ let g;
+ let b;
+ for (let i = 0; i < sortedStops.length; i++) {
+ color.setValue(sortedStops[i].color);
+ const indexStart = i * 3;
+ [r, g, b] = color.toArray();
+ this.stopsUniforms.uColors[indexStart] = r;
+ this.stopsUniforms.uColors[indexStart + 1] = g;
+ this.stopsUniforms.uColors[indexStart + 2] = b;
+ this.stopsUniforms.uStops[i * 4] = sortedStops[i].offset;
+ this.stopsUniforms.uStops[i * 4 + 1] = sortedStops[i].alpha;
+ }
+ this.baseUniforms.uCounts[0] = sortedStops.length;
+ this._stops = sortedStops;
+ }
+ /**
+ * The type of gradient
+ * @default ColorGradientFilter.LINEAR
+ */
+ get type() {
+ return this.baseUniforms.uOptions[0];
+ }
+ set type(value) {
+ this.baseUniforms.uOptions[0] = value;
+ }
+ /**
+ * The angle of the gradient in degrees
+ * @default 90
+ */
+ get angle() {
+ return this.baseUniforms.uOptions[1] + ANGLE_OFFSET$1;
+ }
+ set angle(value) {
+ this.baseUniforms.uOptions[1] = value - ANGLE_OFFSET$1;
+ }
+ /**
+ * The alpha value of the gradient (0-1)
+ * @default 1
+ */
+ get alpha() {
+ return this.baseUniforms.uOptions[2];
+ }
+ set alpha(value) {
+ this.baseUniforms.uOptions[2] = value;
+ }
+ /**
+ * The maximum number of colors to render (0 = no limit)
+ * @default 0
+ */
+ get maxColors() {
+ return this.baseUniforms.uCounts[1];
+ }
+ set maxColors(value) {
+ this.baseUniforms.uCounts[1] = value;
+ }
+ /**
+ * If true, the gradient will replace the existing color, otherwise it
+ * will be multiplied with it
+ * @default false
+ */
+ get replace() {
+ return this.baseUniforms.uOptions[3] > 0.5;
+ }
+ set replace(value) {
+ this.baseUniforms.uOptions[3] = value ? 1 : 0;
+ }
+ };
+ __publicField$Y(_ColorGradientFilter$1, "LINEAR", 0);
+ __publicField$Y(_ColorGradientFilter$1, "RADIAL", 1);
+ __publicField$Y(_ColorGradientFilter$1, "CONIC", 2);
+ __publicField$Y(_ColorGradientFilter$1, "defaults", {
+ type: _ColorGradientFilter$1.LINEAR,
+ stops: [
+ { offset: 0, color: 16711680, alpha: 1 },
+ { offset: 1, color: 255, alpha: 1 }
+ ],
+ alpha: 1,
+ angle: 90,
+ maxColors: 0,
+ replace: false
+ });
+ let ColorGradientFilter$2 = _ColorGradientFilter$1;
+ ColorGradientFilter$3.ColorGradientFilter = ColorGradientFilter$2;
+
+ var ColorMapFilter$2 = {};
+
+ var colorMap$3 = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var fragment = "in vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform sampler2D uMapTexture;\nuniform float uMix;\nuniform float uSize;\nuniform float uSliceSize;\nuniform float uSlicePixelSize;\nuniform float uSliceInnerSize;\n\nvoid main() {\n vec4 color = texture(uTexture, vTextureCoord.xy);\n vec4 adjusted;\n\n if (color.a > 0.0) {\n color.rgb /= color.a;\n float innerWidth = uSize - 1.0;\n float zSlice0 = min(floor(color.b * innerWidth), innerWidth);\n float zSlice1 = min(zSlice0 + 1.0, innerWidth);\n float xOffset = uSlicePixelSize * 0.5 + color.r * uSliceInnerSize;\n float s0 = xOffset + (zSlice0 * uSliceSize);\n float s1 = xOffset + (zSlice1 * uSliceSize);\n float yOffset = uSliceSize * 0.5 + color.g * (1.0 - uSliceSize);\n vec4 slice0Color = texture(uMapTexture, vec2(s0,yOffset));\n vec4 slice1Color = texture(uMapTexture, vec2(s1,yOffset));\n float zOffset = fract(color.b * innerWidth);\n adjusted = mix(slice0Color, slice1Color, zOffset);\n\n color.rgb *= color.a;\n }\n\n finalColor = vec4(mix(color, adjusted, uMix).rgb, color.a);\n\n}";
+ exports["default"] = fragment;
+ })(colorMap$3);
+
+ var colorMap2 = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var source = "struct ColorMapUniforms {\n uMix: f32,\n uSize: f32,\n uSliceSize: f32,\n uSlicePixelSize: f32,\n uSliceInnerSize: f32,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var colorMapUniforms : ColorMapUniforms;\n@group(1) @binding(1) var uMapTexture: texture_2d;\n@group(1) @binding(2) var uMapSampler: sampler;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n var color:vec4 = textureSample(uTexture, uSampler, uv);\n\n var adjusted: vec4;\n\n var altColor: vec4 = vec4(color.rgb / color.a, color.a);\n let innerWidth: f32 = colorMapUniforms.uSize - 1.0;\n let zSlice0: f32 = min(floor(color.b * innerWidth), innerWidth);\n let zSlice1: f32 = min(zSlice0 + 1.0, innerWidth);\n let xOffset: f32 = colorMapUniforms.uSlicePixelSize * 0.5 + color.r * colorMapUniforms.uSliceInnerSize;\n let s0: f32 = xOffset + (zSlice0 * colorMapUniforms.uSliceSize);\n let s1: f32 = xOffset + (zSlice1 * colorMapUniforms.uSliceSize);\n let yOffset: f32 = colorMapUniforms.uSliceSize * 0.5 + color.g * (1.0 - colorMapUniforms.uSliceSize);\n let slice0Color: vec4 = textureSample(uMapTexture, uMapSampler, vec2(s0,yOffset));\n let slice1Color: vec4 = textureSample(uMapTexture, uMapSampler, vec2(s1,yOffset));\n let zOffset: f32 = fract(color.b * innerWidth);\n adjusted = mix(slice0Color, slice1Color, zOffset);\n altColor = vec4(color.rgb * color.a, color.a);\n\n let realColor: vec4 = select(color, altColor, color.a > 0.0);\n\n return vec4(mix(realColor, adjusted, colorMapUniforms.uMix).rgb, realColor.a);\n}";
+ exports["default"] = source;
+ })(colorMap2);
+
+ var __defProp$X = Object.defineProperty;
+ var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
+ var __hasOwnProp$o = Object.prototype.hasOwnProperty;
+ var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
+ var __defNormalProp$X = (obj, key, value) => key in obj ? __defProp$X(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+ var __spreadValues$o = (a, b) => {
+ for (var prop in b || (b = {}))
+ if (__hasOwnProp$o.call(b, prop))
+ __defNormalProp$X(a, prop, b[prop]);
+ if (__getOwnPropSymbols$o)
+ for (var prop of __getOwnPropSymbols$o(b)) {
+ if (__propIsEnum$o.call(b, prop))
+ __defNormalProp$X(a, prop, b[prop]);
+ }
+ return a;
+ };
+ Object.defineProperty(ColorMapFilter$2, "__esModule", { value: true });
+ var pixi_js$r = require$$0__default["default"];
+ var _default$1$r = _default$A;
+ var _default$s = default2;
+ var colorMap$1 = colorMap$3;
+ var colorMap$2 = colorMap2;
+ var __defProp2$o = Object.defineProperty;
+ var __defNormalProp2$o = (obj, key, value) => key in obj ? __defProp2$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+ var __publicField$X = (obj, key, value) => {
+ __defNormalProp2$o(obj, typeof key !== "symbol" ? key + "" : key, value);
+ return value;
+ };
+ const _ColorMapFilter$1 = class _ColorMapFilter2 extends pixi_js$r.Filter {
+ constructor(options) {
+ options = __spreadValues$o(__spreadValues$o({}, _ColorMapFilter2.DEFAULT_OPTIONS), options);
+ if (!options.colorMap)
+ throw Error("No color map texture source was provided to ColorMapFilter");
+ const gpuProgram = new pixi_js$r.GpuProgram({
+ vertex: {
+ source: _default$s["default"],
+ entryPoint: "mainVertex"
+ },
+ fragment: {
+ source: colorMap$2["default"],
+ entryPoint: "mainFragment"
+ }
+ });
+ const glProgram = new pixi_js$r.GlProgram({
+ vertex: _default$1$r["default"],
+ fragment: colorMap$1["default"],
+ name: "color-map-filter"
+ });
+ super({
+ gpuProgram,
+ glProgram,
+ resources: {
+ colorMapUniforms: {
+ uMix: { value: options.mix, type: "f32" },
+ uSize: { value: 0, type: "f32" },
+ uSliceSize: { value: 0, type: "f32" },
+ uSlicePixelSize: { value: 0, type: "f32" },
+ uSliceInnerSize: { value: 0, type: "f32" }
+ },
+ uMapTexture: options.colorMap.source,
+ uMapSampler: options.colorMap.source.style
+ }
+ });
+ __publicField$X(this, "uniforms");
+ __publicField$X(this, "_size", 0);
+ __publicField$X(this, "_sliceSize", 0);
+ __publicField$X(this, "_slicePixelSize", 0);
+ __publicField$X(this, "_sliceInnerSize", 0);
+ __publicField$X(this, "_nearest", false);
+ __publicField$X(this, "_scaleMode", "linear");
+ __publicField$X(this, "_colorMap");
+ this.uniforms = this.resources.colorMapUniforms.uniforms;
+ Object.assign(this, options);
+ }
+ /** The mix from 0 to 1, where 0 is the original image and 1 is the color mapped image. */
+ get mix() {
+ return this.uniforms.uMix;
+ }
+ set mix(value) {
+ this.uniforms.uMix = value;
+ }
+ /**
+ * The size of one color slice.
+ * @readonly
+ */
+ get colorSize() {
+ return this._size;
+ }
+ /** The colorMap texture. */
+ get colorMap() {
+ return this._colorMap;
+ }
+ set colorMap(value) {
+ if (!value || value === this.colorMap)
+ return;
+ const source2 = value instanceof pixi_js$r.Texture ? value.source : value;
+ source2.style.scaleMode = this._scaleMode;
+ source2.autoGenerateMipmaps = false;
+ this._size = source2.height;
+ this._sliceSize = 1 / this._size;
+ this._slicePixelSize = this._sliceSize / this._size;
+ this._sliceInnerSize = this._slicePixelSize * (this._size - 1);
+ this.uniforms.uSize = this._size;
+ this.uniforms.uSliceSize = this._sliceSize;
+ this.uniforms.uSlicePixelSize = this._slicePixelSize;
+ this.uniforms.uSliceInnerSize = this._sliceInnerSize;
+ this.resources.uMapTexture = source2;
+ this._colorMap = value;
+ }
+ /** Whether use NEAREST for colorMap texture. */
+ get nearest() {
+ return this._nearest;
+ }
+ set nearest(nearest) {
+ this._nearest = nearest;
+ this._scaleMode = nearest ? "nearest" : "linear";
+ const texture = this._colorMap;
+ if (texture && texture.source) {
+ texture.source.scaleMode = this._scaleMode;
+ texture.source.autoGenerateMipmaps = false;
+ texture.source.style.update();
+ texture.source.update();
+ }
+ }
+ /**
+ * If the colorMap is based on canvas,
+ * and the content of canvas has changed, then call `updateColorMap` for update texture.
+ */
+ updateColorMap() {
+ const texture = this._colorMap;
+ if (texture == null ? void 0 : texture.source) {
+ texture.source.update();
+ this.colorMap = texture;
+ }
+ }
+ /**
+ * Destroys this filter
+ * @default false
+ */
+ destroy() {
+ var _a;
+ (_a = this._colorMap) == null ? void 0 : _a.destroy();
+ super.destroy();
+ }
+ };
+ __publicField$X(_ColorMapFilter$1, "DEFAULT_OPTIONS", {
+ colorMap: pixi_js$r.Texture.WHITE,
+ nearest: false,
+ mix: 1
+ });
+ let ColorMapFilter$1 = _ColorMapFilter$1;
+ ColorMapFilter$2.ColorMapFilter = ColorMapFilter$1;
+
+ var ColorOverlayFilter$2 = {};
+
+ var colorOverlay$3 = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var fragment = "in vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec3 uColor;\nuniform float uAlpha;\n\nvoid main(void) {\n vec4 c = texture(uTexture, vTextureCoord);\n finalColor = vec4(mix(c.rgb, uColor.rgb, c.a * uAlpha), c.a);\n}\n";
+ exports["default"] = fragment;
+ })(colorOverlay$3);
+
+ var colorOverlay2 = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var source = "struct ColorOverlayUniforms {\n uColor: vec3,\n uAlpha: f32,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var colorOverlayUniforms : ColorOverlayUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let c = textureSample(uTexture, uSampler, uv);\n return vec4(mix(c.rgb, colorOverlayUniforms.uColor.rgb, c.a * colorOverlayUniforms.uAlpha), c.a);\n}\n";
+ exports["default"] = source;
+ })(colorOverlay2);
+
+ var __defProp$W = Object.defineProperty;
+ var __getOwnPropSymbols$n = Object.getOwnPropertySymbols;
+ var __hasOwnProp$n = Object.prototype.hasOwnProperty;
+ var __propIsEnum$n = Object.prototype.propertyIsEnumerable;
+ var __defNormalProp$W = (obj, key, value) => key in obj ? __defProp$W(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+ var __spreadValues$n = (a, b) => {
+ for (var prop in b || (b = {}))
+ if (__hasOwnProp$n.call(b, prop))
+ __defNormalProp$W(a, prop, b[prop]);
+ if (__getOwnPropSymbols$n)
+ for (var prop of __getOwnPropSymbols$n(b)) {
+ if (__propIsEnum$n.call(b, prop))
+ __defNormalProp$W(a, prop, b[prop]);
+ }
+ return a;
+ };
+ Object.defineProperty(ColorOverlayFilter$2, "__esModule", { value: true });
+ var pixi_js$q = require$$0__default["default"];
+ var _default$1$q = _default$A;
+ var _default$r = default2;
+ var colorOverlay$1 = colorOverlay$3;
+ var colorOverlay$2 = colorOverlay2;
+ var __defProp2$n = Object.defineProperty;
+ var __defNormalProp2$n = (obj, key, value) => key in obj ? __defProp2$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+ var __publicField$W = (obj, key, value) => {
+ __defNormalProp2$n(obj, typeof key !== "symbol" ? key + "" : key, value);
+ return value;
+ };
+ const _ColorOverlayFilter$1 = class _ColorOverlayFilter2 extends pixi_js$q.Filter {
+ constructor(options = {}) {
+ var _a;
+ options = __spreadValues$n(__spreadValues$n({}, _ColorOverlayFilter2.DEFAULT_OPTIONS), options);
+ const gpuProgram = new pixi_js$q.GpuProgram({
+ vertex: {
+ source: _default$r["default"],
+ entryPoint: "mainVertex"
+ },
+ fragment: {
+ source: colorOverlay$2["default"],
+ entryPoint: "mainFragment"
+ }
+ });
+ const glProgram = new pixi_js$q.GlProgram({
+ vertex: _default$1$q["default"],
+ fragment: colorOverlay$1["default"],
+ name: "color-overlay-filter"
+ });
+ super({
+ gpuProgram,
+ glProgram,
+ resources: {
+ colorOverlayUniforms: new pixi_js$q.UniformGroup({
+ uColor: { value: new Float32Array(3), type: "vec3" },
+ uAlpha: { value: options.alpha, type: "f32" }
+ })
+ }
+ });
+ __publicField$W(this, "uniforms");
+ __publicField$W(this, "_color");
+ this.uniforms = this.resources.colorOverlayUniforms.uniforms;
+ this._color = new pixi_js$q.Color();
+ this.color = (_a = options.color) != null ? _a : 0;
+ }
+ /**
+ * The over color source
+ * @member {number|Array|Float32Array}
+ * @default 0x000000
+ */
+ get color() {
+ return this._color.value;
+ }
+ set color(value) {
+ this._color.setValue(value);
+ const [r, g, b] = this._color.toArray();
+ this.uniforms.uColor[0] = r;
+ this.uniforms.uColor[1] = g;
+ this.uniforms.uColor[2] = b;
+ }
+ /**
+ * The alpha value of the color
+ * @default 1
+ */
+ get alpha() {
+ return this.uniforms.uAlpha;
+ }
+ set alpha(value) {
+ this.uniforms.uAlpha = value;
+ }
+ };
+ __publicField$W(_ColorOverlayFilter$1, "DEFAULT_OPTIONS", {
+ /** The color of the overlay */
+ color: 0,
+ /** The alpha of the overlay */
+ alpha: 1
+ });
+ let ColorOverlayFilter$1 = _ColorOverlayFilter$1;
+ ColorOverlayFilter$2.ColorOverlayFilter = ColorOverlayFilter$1;
+
+ var ColorReplaceFilter$2 = {};
+
+ var colorReplace$3 = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var fragment = "in vec2 vTextureCoord;\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform vec3 uOriginalColor;\nuniform vec3 uTargetColor;\nuniform float uTolerance;\n\nvoid main(void) {\n vec4 c = texture(uTexture, vTextureCoord);\n vec3 colorDiff = uOriginalColor - (c.rgb / max(c.a, 0.0000000001));\n float colorDistance = length(colorDiff);\n float doReplace = step(colorDistance, uTolerance);\n finalColor = vec4(mix(c.rgb, (uTargetColor + colorDiff) * c.a, doReplace), c.a);\n}\n";
+ exports["default"] = fragment;
+ })(colorReplace$3);
+
+ var colorReplace2 = {};
+
+ (function(exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var source = "struct ColorReplaceUniforms {\n uOriginalColor: vec3,\n uTargetColor: vec3,\n uTolerance: f32,\n};\n\n@group(0) @binding(1) var uTexture: texture_2d; \n@group(0) @binding(2) var uSampler: sampler;\n@group(1) @binding(0) var colorReplaceUniforms : ColorReplaceUniforms;\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4,\n @location(0) uv : vec2\n) -> @location(0) vec4 {\n let sample: vec4 = textureSample(uTexture, uSampler, uv);\n\n let colorDiff: vec3